2011-10-30 15 views
5

./data/transactions/foobarのBerkeley DBから開いて読み込むTomcat用のGrails Webアプリケーションを作成しました。Grails/Tomcat Webappの現在の作業ディレクトリを取得するにはどうすればよいですか?

このコードは、Eclipse環境で正常に動作します。

しかし、サーバーに移動すると、この例外が発生します。私はGrailsをWARファイルにサーバー上のWebアプリケーションWebアプリケーションとしてデプロイするときに、現在の作業ディレクトリの場所がわかりません。

com.sleepycat.je.EnvironmentNotFoundException: (JE 4.1.10) ./data/transactions/Foobar 
Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

LinuxサーバーのMy Tomcatインストールディレクトリは、/ usr/share/tomcat6です。 webappsのルートディレクトリは/ usr/share/tomcat6/webappsです。 WARディレクトリは、 "bridge"という名前のサブディレクトリにインストールされています。私のGrailsアプリケーションへのWARパスは/ usr/share/tomcat6/webapps/bridgeにあります。

私は/ usr/share/tomcat6/webappsと/ usr/share/tomcat6/webapps/bridge、運がない。

私は/ usr/share/tomcat6にbaseディレクトリをインストールすることもできました。

次は、私はTomcatサーバーから参照エラーです:

Error 500: Executing action [index] of controller[com.ecmhp.ecmdatabridge.generators.GenerateEmiDigestsController] 
caused exception: (JE 4.1.10) ./data/transactions/Foobar 
    Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
    EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

サーブレット:Grailsの

URI:/bridge/grails/generateEmiDigests/index.dispatch

Exception Message: (JE 4.1.10) ./data/transactions/Foobar 
Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

Caused by: (JE 4.1.10) ./data/transactions/Foobar 
    Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: 
    EnvironmentConfig.setAllowCreate is false so environment creation is not permitted, but there are no log files in the environment directory. Environment is invalid and must be closed. 

どれでも私のTomcat WARの現在の作業ディレクトリをBerkeley DB ./data/transactionファイルを見つけるためにどのように設定できるのか?または、現在の作業ディレクトリがGrailsアプリケーションであることを知ることができますか?

答えて

1

あなたはGrailsのためにコンソールプラグインをインストールした場合、あなただけの我々のアプリについて

new File('test.html').absolutePath 

を実行することができ、これは/data/opt/tomcat/5.5/を返しますので、私はあなたがあなたのディレクトリを配置する必要があることを想像しますUSR /シェア/ tomcat6 /データ/取引

8

内部のあなたがあるか、あなたが試すことができGrailsのフレームワークのさまざまな部分でautoinjectedことができる「grailsApplication」豆のホールドを得ることができる場合:

grailsApplication.mainContext.servletContext.getRealPath('/data/transactions/foobar') 
関連する問題