embedded tomcat and JspServlet

2002-04-30 Thread Richard Unger

I've written an Embedded tomcat (4.0.3) that reads in the standard 
${catalina.home}/conf/web.xml.  Servlets and .war files work fine.  However, when I 
try to fetch a jsp page, the result comes back with several stack traces to the effect 
of not being able to find the javax.servlet package and classes.

The catalina log contains:

jsp: init
Internal Error: File /WEB-INF/web.xml not found.

Any notions?

Thanks,
Rich

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Classloader issue with Embedded tomcat and WAR deployment

2002-04-02 Thread Richard Unger

I figured it out.  For the curious, I was specifying a loader for my root context, but 
that wasn't being propogated to any WAR files, only to servlets explicitly added to 
the root context at startup time.  I had to set the parent classloader on the host 
which was loading the WAR files.

Rich

 -Original Message-
 From: Richard Unger 
 Sent: Monday, April 01, 2002 4:36 PM
 To: '[EMAIL PROTECTED]'
 Subject: Classloader issue with Embedded tomcat and WAR deployment
 
 
 I'm making a tomcat 4.0.3 module for netbeans, and I'm 
 running into an odd problem with the 
 org.apache.catalina.loader.WebappClassLoader.
 
 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(ClassLoader.java:493)
 at 
 java.security.SecureClassLoader.defineClass(SecureClassLoader.
 java:111)
 at 
 org.apache.catalina.loader.WebappClassLoader.findClassInternal
 (WebappClassLoader.java:1631)
 at 
 org.apache.catalina.loader.WebappClassLoader.findClass(WebappC
 lassLoader.java:926)
 at 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC
 lassLoader.java:1360)
 at 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappC
 lassLoader.java:1243)
 at 
 org.apache.catalina.core.StandardWrapper.loadServlet(StandardW
 rapper.java:865)
 at 
 org.apache.catalina.core.StandardWrapper.load(StandardWrapper.
 java:808)
 at 
 org.apache.catalina.core.StandardContext.loadOnStartup(Standar
 dContext.java:3266)
 at 
 org.apache.catalina.core.StandardContext.start(StandardContext
 .java:3395)
 at 
 org.apache.catalina.core.ContainerBase.addChild(ContainerBase.
 java:785)
 at 
 org.apache.catalina.core.StandardHost.addChild(StandardHost.java:454)
 at 
 org.apache.catalina.core.StandardHost.install(StandardHost.java:723)
 at 
 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:331)
 at 
 org.apache.catalina.startup.HostConfig.start(HostConfig.java:398)
 at 
 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConf
 ig.java:232)
 at 
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(L
 ifecycleSupport.java:156)
 at 
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)
 
 at 
 org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
 at 
 org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
 
 at 
 org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
 at 
 org.apache.catalina.startup.Embedded.start(Embedded.java:957)
 at 
 org.netbeans.modules.httpserver.TomcatServer.start(Unknown Source)
 at 
 org.netbeans.modules.httpserver.HttpServerModule$1.run(Unknown 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:
 
 classLoader.loadClass(javax.servlet.http.HttpServlet)
 
 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?  How?
 
 
 Rich
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Classloader issue with Embedded tomcat and WAR deployment

2002-04-01 Thread Richard Unger

I'm making a tomcat 4.0.3 module for netbeans, and I'm running into an odd problem 
with the org.apache.catalina.loader.WebappClassLoader.

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(ClassLoader.java:493)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at 
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1631)
at 
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:926)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1243)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:865)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:808)
at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3266)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3395)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:785)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:454)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:723)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:331)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:398)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:232)
at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:156)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1131)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.startup.Embedded.start(Embedded.java:957)
at org.netbeans.modules.httpserver.TomcatServer.start(Unknown Source)
at org.netbeans.modules.httpserver.HttpServerModule$1.run(Unknown 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:

classLoader.loadClass(javax.servlet.http.HttpServlet)

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?  How?


Rich

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]