To embed Tomcat 5, I’ve followed the explanations at the following: http://www.onjava.com/pub/a/onjava/2002/04/03/tomcat.html

 

I register the manager webapp that comes with the Tomcat embedded distribution as follows:

 

  tc.registerWAR("/manager", new URL("file:/" + dir + "/webapps/manager"));

 

The manager webapp has the catalina-manager.jar file in its WEB-INF/lib directory.  Yet, at init time, the webapp can’t find a class that is in this jar file. I get the following:

 

java.lang.ClassNotFoundException: org.apache.catalina.manager.HTMLManagerServlet
        java.net.URLClassLoader$1.run(Unknown Source)
        java.security.AccessController.doPrivileged(Native Method)
        java.net.URLClassLoader.findClass(Unknown Source)
        java.lang.ClassLoader.loadClass(Unknown Source)
        sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        java.lang.ClassLoader.loadClass(Unknown Source)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
        org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
        org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
        org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)

 

From the stack, it seems that the system classloader is used (no specific classloader seems to have been assigned to the webapp). If I put the catalina-manager.jar file in the path that is “seen” by the system classloader, then all is fine.

 

My question is: if Tomcat does not assign a classloader to my webapp (so that classes in WEB-INF are properly loaded), is there a way to do it programatically?

 

Thanks!

 

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

Reply via email to