2010-12-10 11 views
6

私は、リモートサーバー上のTomcat 6の下にWARを配備しようとしています。今私がローカルマシンに展開すると、すべて正常に動作します。リモート展開では、非常に不都合な例外セットがトリガされます。Grailsの配備に関する問題(WAR&Tomcat)

log4j:ERROR setFile(null,true) call failed. 
java.io.FileNotFoundException: stacktrace.log (Permission denied) 
    at java.io.FileOutputStream.openAppend(Native Method) 
    at java.io.FileOutputStream.<init>(FileOutputStream.java:207) 
    at java.io.FileOutputStream.<init>(FileOutputStream.java:131) 
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:294) 
    at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:616) 
    <...snip> 
ERROR initWebApplicationContext, Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    at java.lang.Thread.run(Thread.java:636) 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    ... 1 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    ... 1 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    ... 1 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    ... 1 more 
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    ... 1 more 
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)) 
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225) 
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) 
    at $Proxy15.getMetaData(Unknown Source) 
    ... 1 more 
Caused by: java.sql.SQLException: File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied) 
    at org.hsqldb.jdbc.Util.sqlException(Unknown Source) 
    at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source) 
    at org.hsqldb.jdbcDriver.getConnection(Unknown Source) 
    at org.hsqldb.jdbcDriver.connect(Unknown Source) 
    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) 
    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294) 
    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247) 
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221) 
    ... 3 more 

私はデータベースとしてHSQLDBを使用しています。

サービスとしてTomcatが実行されているので、にはに許可の問題はありません。何かのアクセス許可を変更する必要がありますか(アクセスが見つからないため、どこにいるのでしょうか)。ログを記録しない、またはリダイレクトするためにGrailsで設定できる設定オプションはありますか?

答えて

20

これはロギングではなく、「prodDB.properties」に関するものです。 FileNotFoundExceptionが書き込まれる(または名前が変更される可能性がある)ため、FileNotFoundExceptionが発生しています。アプリを実行しているユーザーは、HSQLDBデータベースファイルを作成するディレクトリに書き込み権限を持っていてはなりません。

アプリが起動されている場所、それは書いていますので、デフォルトの設定は、相対パスを使用していますから:

production { 
    dataSource { 
     dbCreate = "update" 
     url = "jdbc:hsqldb:file:prodDb;shutdown=true" 
    } 
} 

一つの修正はハードコードにDataSource.groovyでのパスです:

production { 
    dataSource { 
     dbCreate = "update" 
     url = "jdbc:hsqldb:file:/some/writeable/folder/prodDb;shutdown=true" 
    } 
} 

よりよい1はConfig.groovyに外部の設定ファイルを有効にすることです:

grails.config.locations = ["classpath:${appName}-config.groovy"] 

とクレア

dataSource { 
    url = "jdbc:hsqldb:file:/some/writeable/folder/prodDb;shutdown=true" 
} 

とTomcatのクラスパス(アプリ名に変更FOOを)である$ TOMCAT_HOME/libにFOO-config.groovyを置くを含むTE FOO-config.groovy。この方法で、複数の場所に戦争を展開し、Config.groovyで単一の値をハードコーディングするのではなく、設定ファイルだけを上書きすることができます。

私はTomcatを起動するショートカットを使用していたのWindows 7にアップグレードし、私は「スタートで」ディレクトリへの単なる「C:\」を設定したときに、私は突然、この問題が発生した
1

。 Windows 7では管理者以外のユーザーはこのディレクトリに書き込めません。私は "TomcatData"と呼ばれる私のユーザの家のサブディレクトリを作成し、そこからTomcatを起動するためのショートカットを変更しました。すべてが現在正常に動作します。

関連する問題