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?