我为Tomcat编写了一个Grails webapp,它打开并从Berkeley DB上读取./data/transactions/foobar。如何获取Grails/Tomcat Webapp的当前工作目录?
此代码在我的Eclipse环境中运行良好。
但是当我将它移动到服务器时,它吐出了这个异常。当我将WAR文件中的Grails部署为服务器上的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.
我的Tomcat安装目录在Linux服务器上是/ usr/share/tomcat6。 webapps的根目录是/ usr/share/tomcat6/webapps。我们的WAR目录安装在名为“bridge”的子目录中。我的Grails应用程序的WAR路径位于/ usr/share/tomcat6/webapps/bridge
我尝试将./data/transaction/Foobar放入/ usr/share/tomcat6/webapps和/ usr/share/tomcat6/webapps/bridge,没有运气。
我也尝试把./data/transaction/Foobar放入/ usr/share/tomcat6安装基本目录,也没有运气。
以下是我从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.
的Servlet: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应用程序启动?