rleelink
asked on
How do I set working directory for Tomcat Grails WAR app?
I wrote a Grails webapp for Tomcat that opens and reads from a Berkeley DB on ./data/transactions/foobar .
This code runs fine in my Eclipse environmet.
But when I move it to the server, it spits out this exception. I am not sure where the current working directory when I deploy the Grails in a WAR file as a webapps web application on the Server.
com.sleepycat.je.Environme ntNotFound Exception: (JE 4.1.10) ./data/transactions/Foobar Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: EnvironmentConfig.setAllow Create 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.
My Tomcat install directory on the Linux server is /usr/share/tomcat6. The webapps root dir is /usr/share/tomcat6/webapps . We WAR directory is in installed in a subdirectory named "bridge." The WAR path to my Grails app is in /usr/share/tomcat6/webapps /bridge
I tried putting the ./data/transaction/Foobar in both /usr/share/tomcat6/webapps and /usr/share/tomcat6/webapps /bridge, with no luck.
I also tried putting ./data/transaction/Foobar into /usr/share/tomcat6 install base directory, also with no luck.
The following are the errors I see from the Tomcat server:
Error 500: Executing action [index] of controller [com.ecmhp.ecmdatabridge.g enerators. GenerateEm iDigestsCo ntroller] caused exception: (JE 4.1.10) ./data/transactions/Foobar Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: EnvironmentConfig.setAllow Create 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/generateEmi Digests/in dex.dispat ch
Exception Message: (JE 4.1.10) ./data/transactions/Foobar Home directory: ./data/transactions/Foobar ENV_NOT_FOUND: EnvironmentConfig.setAllow Create 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.setAllow Create 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.
Any idea how I can set the current working directory for my Tomcat WAR so that it finds the Berkeley DB ./data/transaction files? Or any idea I can find out what the current working directory is my Grails app is launched?
This code runs fine in my Eclipse environmet.
But when I move it to the server, it spits out this exception. I am not sure where the current working directory when I deploy the Grails in a WAR file as a webapps web application on the Server.
com.sleepycat.je.Environme
My Tomcat install directory on the Linux server is /usr/share/tomcat6. The webapps root dir is /usr/share/tomcat6/webapps
I tried putting the ./data/transaction/Foobar in both /usr/share/tomcat6/webapps
I also tried putting ./data/transaction/Foobar into /usr/share/tomcat6 install base directory, also with no luck.
The following are the errors I see from the Tomcat server:
Error 500: Executing action [index] of controller [com.ecmhp.ecmdatabridge.g
Servlet: grails
URI: /bridge/grails/generateEmi
Exception Message: (JE 4.1.10) ./data/transactions/Foobar
Caused by: (JE 4.1.10) ./data/transactions/Foobar
Any idea how I can set the current working directory for my Tomcat WAR so that it finds the Berkeley DB ./data/transaction files? Or any idea I can find out what the current working directory is my Grails app is launched?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, the line:
URI: /bridge/grails/generateEmi Digests/in dex.dispat ch
...sure implies that it's working directory is /usr/share/tomcat6/webapps , which sounds right to me from memory.
However, I know you say you have copied data/transactions/foobar into that directory. What happens if you specify an absolute path to /foobar in your application, just out of curiosity?
URI: /bridge/grails/generateEmi
...sure implies that it's working directory is /usr/share/tomcat6/webapps
However, I know you say you have copied data/transactions/foobar into that directory. What happens if you specify an absolute path to /foobar in your application, just out of curiosity?
ASKER
Putting in the absolute path did not fix it. However, it turned out to be permission problem. Opening up the file permissioon of directory ./data/transactions/Foobar fixed the problem
Nice catch!
ASKER