Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How do I set working directory for Tomcat Grails WAR app?

Posted on 2011-10-30
5
Medium Priority
?
516 Views
Last Modified: 2012-06-27
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.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.

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.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.

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?
0
Comment
Question by:rleelink
  • 3
  • 2
5 Comments
 
LVL 19

Accepted Solution

by:
xterm earned 1000 total points
ID: 37054927
Flyer here, but you say initially you're reading from ./data/transactions/foobar, but the error references ./data/transactions/Foobar - capital F.   Does the same mismatch occur on your server, or was it just a typo in your question posting?

If your case does match, then is there any particular reason you can't specify an absolute path instead of a relative one in your application?  ie. /full/path/to/data/transactions/foobar?
0
 

Author Comment

by:rleelink
ID: 37057410
Good catch, xterm.  I meant to type "Foobar".  It's not a case mismatch problem.  Hoping for someone to give me hints as to what Tomcat web apps uses as its working directory.
0
 
LVL 19

Expert Comment

by:xterm
ID: 37057675
Well, the line:

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

...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?
0
 

Author Comment

by:rleelink
ID: 37332708
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
0
 
LVL 19

Expert Comment

by:xterm
ID: 37332750
Nice catch!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses
Course of the Month15 days, 11 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question