tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Unger" <>
Subject Classloader issue with Embedded tomcat and WAR deployment
Date Tue, 02 Apr 2002 00:36:10 GMT
I'm making a tomcat 4.0.3 module for netbeans, and I'm running into an odd problem with the

I'm utilizing the Embedded class to build my server, and I'm using the HostConfig mechanism
for rolling in WAR files.  I have no trouble loading individual servlets, but when I start
the server with a WAR file in place, I get a NoClassDefFoundError: javax/servlet/http/HttpServlet.
 The error is masked by a catch( Throwable t) clause in HostConfig::deployApps, but when I
explicitly print the stack trace, it looks like:

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(
        at org.apache.catalina.loader.WebappClassLoader.findClass(
        at org.apache.catalina.loader.WebappClassLoader.loadClass(
        at org.apache.catalina.loader.WebappClassLoader.loadClass(
        at org.apache.catalina.core.StandardWrapper.loadServlet(
        at org.apache.catalina.core.StandardWrapper.load(
        at org.apache.catalina.core.StandardContext.loadOnStartup(
        at org.apache.catalina.core.StandardContext.start(
        at org.apache.catalina.core.ContainerBase.addChild(
        at org.apache.catalina.core.StandardHost.addChild(
        at org.apache.catalina.core.StandardHost.install(
        at org.apache.catalina.startup.HostConfig.deployApps(
        at org.apache.catalina.startup.HostConfig.start(
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
        at org.apache.catalina.core.ContainerBase.start(

        at org.apache.catalina.core.StandardHost.start(
        at org.apache.catalina.core.ContainerBase.start(

        at org.apache.catalina.core.StandardEngine.start(
        at org.apache.catalina.startup.Embedded.start(
        at org.netbeans.modules.httpserver.TomcatServer.start(Unknown Source)
        at org.netbeans.modules.httpserver.HttpServerModule$ Source)

Delving into StandardWrapper line 865, I see the classloader attempting to load the servlet
residing in the WAR file.  This servlet extends HttpServlet, and that's where my error is
coming from.  However, if I stick in a line:


before line 865, everything works fine.  I'm guessing this is because HttpServlet gets loaded
in an earlier run of StandardWrapper::loadServlet() (like when the DefaultServlet gets loaded).

Must I explicitly set the parent classloader for the org.apache.catalina.loader.WebappLoader?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message