rle*_*lee 5 grails tomcat working-directory
我为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.
Run Code Online (Sandbox Code Playgroud)
Linux服务器上的我的Tomcat安装目录是/ usr/share/tomcat6.webapps root目录是/ 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.
Run Code Online (Sandbox Code Playgroud)
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.
Run Code Online (Sandbox Code Playgroud)
知道我如何设置我的Tomcat WAR的当前工作目录,以便它找到Berkeley DB ./data/transaction文件?或任何想法,我可以找到当前的工作目录是我的Grails应用程序启动?
如果您可以获取'grailsApplication'bean,它可以在Grails框架的不同部分自动注入,您可以尝试:
grailsApplication.mainContext.servletContext.getRealPath('/data/transactions/foobar')
Run Code Online (Sandbox Code Playgroud)
如果你安装了 grails 的控制台插件,你可以运行
new File( 'test.html' ).absolutePath
Run Code Online (Sandbox Code Playgroud)
对于我们的应用程序,这将返回 /data/opt/tomcat/5.5/,所以我想您需要将目录放入 usr/share/tomcat6/data/transactions 中
| 归档时间: |
|
| 查看次数: |
5538 次 |
| 最近记录: |