Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.IllegalArgumentException: Document base dir does not exist or is not a readable directory

 
Jim Armstrong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would someone tell me why I may be getting this error? Am I missing something between the double quotes?

Sep 12, 2013 10:30:26 PM org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /usr/share/tomcat/webapps/usr/share/tomcat/webapps/examples does not exist or is not a readable directory

Here's a snip from the server.xml
<Context path=""
docBase="usr/share/tomcat/webapps/examples"
debug="0" reloadable="true" />

Searching the forum I found a similar post.

http://www.coderanch.com/t/86668/Tomcat/running-simple-Servlet-Tomcat

I've checked the server.xml file for the word "context" and there's only the one instance stated up above. I've checked the spelling. And I've searched for server.xml to ensure I only have one such file on the server. If you need more info let me know.

Thanks in advance.

Debian 7

# java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that by making your "docbase" attribute refer to a relative path, you have caused it to refer to a nonexistent directory.

(And since this is a Tomcat question I'm going to move it to the Tomcat forum.)
 
Jim Armstrong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The subdirectory /usr/share/tomcat/webapps/example does exist. It's owned by the tomcat user and tomcat group. I logged in as tomcat, and used touch to create a file in it. I'm really wondering why I see it doubled up like that.
 
Jim Armstrong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I think that by making your "docbase" attribute refer to a relative path, you have caused it to refer to a nonexistent directory.

(And since this is a Tomcat question I'm going to move it to the Tomcat forum.)


Paul thanks for moving it to the Tomcat forum, my mistake.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim Armstrong wrote:The subdirectory /usr/share/tomcat/webapps/example does exist. It's owned by the tomcat user and tomcat group. I logged in as tomcat, and used touch to create a file in it. I'm really wondering why I see it doubled up like that.


Well, like I said it's because you didn't actually specify the subdirectory /usr/share/tomcat/webapps/example. Instead you specified the relative path usr/share/tomcat/webapps/example. You can tell what Tomcat's current working directory is by subtracting that path of the end of the path in the error message, but having to know what Tomcat's working directory is is a bad strategy. Just specify the absolute path.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18165
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Tomcat server's default webapp base is located at /usr/share/tomcat/webapps. By using the relative path " usr/share/tomcat/webapps/examples" you have constructed the path " /usr/share/tomcat/webapps/usr/share/tomcat/webapps/examples".

THAT directory, I will wager does NOT exist.

The proper context path in relative terms would be simply "examples", not " usr/share/tomcat/webapps/examples".

The better choice for context path would be " /usr/share/tomcat/webapps/examples" (absolute path).

I actually prefer to deploy my webapps to external locations, so my Context bases are more like "/opt/com/mousetech/product1/product1.war".

Relative paths are dangerous, though. Regardless of where you deploy, I recommend using an absolute path to reference it.
 
Jim Armstrong
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Your Tomcat server's default webapp base is located at /usr/share/tomcat/webapps. By using the relative path " usr/share/tomcat/webapps/examples" you have constructed the path " /usr/share/tomcat/webapps/usr/share/tomcat/webapps/examples".

THAT directory, I will wager does NOT exist.

The proper context path in relative terms would be simply "examples", not " usr/share/tomcat/webapps/examples".

The better choice for context path would be " /usr/share/tomcat/webapps/examples" (absolute path).

I actually prefer to deploy my webapps to external locations, so my Context bases are more like "/opt/com/mousetech/product1/product1.war".

Relative paths are dangerous, though. Regardless of where you deploy, I recommend using an absolute path to reference it.


Tim that wager would have been easy money.
Many thanks to both of you for squaring me away. Setting it as the absolute path resolved the error.

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html This link was helpful too. Passing it along for the next greenhorn who stumbles down this path.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic