aspose file tools*
The moose likes Tomcat and the fly likes Tomcat WAR deployment incomplete (sometimes). Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat WAR deployment incomplete (sometimes)." Watch "Tomcat WAR deployment incomplete (sometimes)." New topic
Author

Tomcat WAR deployment incomplete (sometimes).

Atul Singhal
Greenhorn

Joined: Mar 04, 2012
Posts: 10
Greetings,

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:

catlina.log:

SEVERE: Error listenerStart
May 16, 2012 11:04:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors


localhost.log

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
java.lang.NoClassDefFoundError: org/quartz/SchedulerException
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' :


<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="/myapp" docBase="myapp" />
<Context path="" docBase="myapp" />


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 or http://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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

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.
Atul Singhal
Greenhorn

Joined: Mar 04, 2012
Posts: 10
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:

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="/myapp" docBase="myapp" />
<Context path="" docBase="myapp" />



When I start tomcat, myapp.war file is exploded into ROOT and myapp directory. But sometimes, ROOT directory doesn't get all the .war content. Hence the problem!!!

Can I improvise my <Context path declaration by setting other attributes?
Atul Singhal
Greenhorn

Joined: Mar 04, 2012
Posts: 10
To avoid unpacking war problem, I changed the unpacksWAR attribute value to 'false' and not getting this error any longer.

server.xml excerpts:

<Host name="localhost" appBase="webapps"
unpackWARs="false" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">


Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

You can also specify this on a per-application basis using Context elements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat WAR deployment incomplete (sometimes).
 
Similar Threads
error running tomcat 5.0
Getting error----NoContextLoaderListener registered
I'm not able to deploy to Tomcat 5.0.19
server: error ListenerStart
unable to login in tomcat manager