Hi chris,
Argh classloader issues can really be tricky. Sometimes it's the
database drivers that cause problems because they get loaded by the JDK
when using JDBC. Unfortunately there is not *ultimate* trick.
Maybe getting rid of as many classes from the shared directory and
putting everything in WEB-INF/lib might help you ? You might have to do
this for multiple webapps and eat up a lot more memory during dev, but
you could redeploy.
Regards,
Serge Huber.
chris markiewicz wrote:
I recently began deploying some newly developed webapps and I am seeing some
odd behavior.
1) When I deploy it the first time, it works properly.
2) When I redeploy it, I get an error while running the app.
3) When I restart Tomcat, it works properly.
The top of the stack trace is shown below. It starts with:
WebappClassLoader: Lifecycle error : CL stopped
java.lang.Exception: Stack trace
I tracked down the location of the error - essentially the class loader is
trying to instantiate a shared class and it fails.
I did some research and learned that this is a Tomcat 4x issue involving
shared libraries, etc. An excerpt from the release notes is also below.
Does anyone have any experience with this, and/or any suggested solutions?
I tried moving the shared code to various places, but nothing has worked so
far.
Thanks for your time.
Chris
---------------------------------------------------------------
Web application reloading and static fields in shared libraries:
---------------------------------------------------------------
Some shared libraries (many are part of the JDK) keep references to objects
instantiated by the web application. To avoid class loading related problems
(ClassCastExceptions, messages indicating that the classloader
is stopped, ...), the shared libraries state should be reinitialized.
Something which could help is to avoid putting classes which would be
referenced by a shared static field in the web application classloader,
and put them in the shared classloader instead (the JARs should be put in
the "lib" folder, and classes should be put in the "classes" folder).
10:27:47,116 INFO SFUtility:83 - Trying to instantiate
SforceServiceLocator...
10:27:47,120 INFO SFUtility:89 - load class...
10:27:47,125 INFO SFUtility:91 - instantiate obj...
WebappClassLoader: Lifecycle error : CL stopped
WebappClassLoader: Lifecycle error : CL stopped
WebappClassLoader: Lifecycle error : CL stopped
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1064)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1329)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav
a:1289)
at
org.apache.commons.discovery.ResourceClass$1.run(ResourceClass.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.commons.discovery.ResourceClass.loadClass(ResourceClass.java:115)
at
org.apache.axis.configuration.EngineConfigurationFactoryFinder$1.run(EngineC
onfigurationFactoryFinder.java:122)
at java.security.AccessController.doPrivileged(Native Method)