Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

Monday, August 27, 2007

Tomcat: Don't Remove That webapps Directory!

Tomcat comes with a few example applications in the webapps directory. You don't use any of them, and don't even use that directory for your own applications. So you are about to remove the whole directory to save yourself some time when Tomcat starts.

Do that, and and you will be in for some trouble. Tomcat will fail with an error that looks like:

INFO: Marking servlet ops-xforms-server-servlet as unavailable
Aug 20, 2007 6:42:17 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@6a4aef
org.orbeon.oxf.servlet.OPSServlet
java.lang.ClassNotFoundException: org.orbeon.oxf.servlet.OPSServlet

Instead of removing the webapps directory, just remove its content. That leaves you with an empty webapps directory, and your applications will run just fine.

Why does removing the webapps directory create this issue? And what exactly is the meaning of the above message? Is Tomcat just looking for class files in the classes directory, ignoring the content of the lib directory?

Monday, August 20, 2007

Tomcat and Symbolic Links

I didn't expect Tomcat would really care about symbolic links. Say you put together a web application in a directory and want to use a web.xml you have elsewhere. Instead of copying web.xml to the WEB-INF directory, you create a symbolic link.

You would expect this work out of the box, wouldn't you? Well, no. For security reasons Tomcat won't follow your symbolic links, unless you specify on the Context of your web application allowLinking="true", as in:

<context path="/my-app" docBase="/Users/avernet/my-app"
allowLinking="true"/>