I am running out of an intermittent issue where war file is not completely unpacked and tomcat starts loading of classes/resources. As war file is only partially unpacked, therefore all the resources are not available for loading. In my case, I get ClassNotFoundException while class is there inside war file in WEB-INF/lib location but it was not unpacked. This issue doesn't occur every time but happens only once in a while. In my case, I see following errors in the log files:
SEVERE: Error listenerStart
May 16, 2012 11:04:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Context  startup failed due to previous errors
INFO: Initializing Spring root WebApplicationContext
May 16, 2012 11:04:40 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at org.springframework.beans.factory.annotation.AutowiredAnnotati Excerpts of 'server.xml' :
Actually, I want to have two context roots. one is default [/] and another one is [myapp] so that I can access my application either with http://localhost:8080 orhttp://localhost:8080/myapp.
I observed that in the webapps directory two directories are created at the time of tomcat starts . One is ROOT and another one is myapp. But whenever the problem occurs, ROOT directory doesn't have all the contents of .war file which I think leads to the problem.
Tomcat version: 6.0.35
OS: Redhat 5.4
I don't know why .war file is not unpacked completely. Any help is highly appreciated.
First of all, make sure that there is enough free disk space on the server.
Tomcat does not dynamically explode WARs. When a WAR is deployed, Tomcat explodes the entire WAR first, and only then does it start the webapp. A Partially-exploded WAR means something wasn't done right. I have noticed issues when the WAR file is on a network drive, although I get a somewhat different error.
Every webapp instance has one and only one context. No more. You can deploy 2 instances of a webapp, each with its own context root URL, but they will not be the same webapp, even if they are left unexploded to share the same WAR file. The WAR supports the context, not the other way around.
If you want two different context roots to refer to the same webapp instance, you need to define one of them as the canonical ("official") URL and use some sort of URL rewriting mechanism to remap the secondary URL(s). Don't forget to sensitize the code to keep internal URLs within their assigned context!
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Mar 04, 2012
Thanks Tim for the reply.
I can assure you that neither it is a disk space issue nor war is placed on a network drive. There is enough disk space and war is copied manually inside webapps folder.
Name of the war file is : myapp.war and my server.xml looks like: