我为 Tomcat 编写了一个 Grails webapp,它可以打开并从 ./data/transactions/foobar 上的 Berkeley DB 读取数据。
此代码在我的 Eclipse 环境中运行良好。
但是当我将它移动到服务器时,它会吐出这个异常。当我将 WAR 文件中的 Grails 部署为服务器上的 webapps 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 服务器上的 Tomcat 安装目录是 /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.
小服务程序: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 应用程序启动的当前工作目录是什么?