• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat WAR deployment incomplete (sometimes).

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Atul Singhal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also specify this on a per-application basis using Context elements.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic