tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt
Date Thu, 13 Jan 2011 15:47:54 GMT
Hash: SHA1


On 1/13/2011 8:47 AM, Sam Zilverberg wrote:
> I'm running a wicket app on tomcat 6.0.20.


> Once in a while I need to redeploy it (after fixing some stuff, adding
> features and so on).
> This is how I redeploy:
> 1.Use tomcat manager to undeploy the running app.
> 2.Deploy the new app by copying the new WAR file to a library inside tomcat.

Do you do this on the server using a "cp" (or COPY) command? Or, do you
use Tomcat's manager app to deploy the updated webapp?

> Everything seems fine but when I use the app I sometimes get a java.lang.
> NoClassDefFoundError.
> The class can be just about any class in the project and its libs.
> Sometimes its a Hibernate related class, sometimes its a Wicket related
> class and
> sometimes its a class from my app.
> Redeploying once (or a couple of times) solves the problem.
> This is very inconsistent and bothering.
> After deploying I never know if the app is going to be ok or if one of its
> pages will keep throwing internal errors on account of the
> NoClassDefFoundError.
> Did any one ever encounter this kind of problem?

I've heard about this happening with large .WAR files because something
like the following happens:

1. WAR file starts copying, whether a huge, local file or a
moderately-sized remote file via the manager interface.... the point is
that this takes some time
2. Tomcat scans the webapps folder for .war files that have been changed
since it's last auto-deploy cycle and finds the new webapp
3. Tomcat attempts to auto-deploy the webapp, but the war file is not
complete, so Bad Things Happen
4. WAR file completes copying


I can think of a few ways around this:

1. Upgrade. It's possible issues with auto-deploy and/or manager have
been resolved. Read the ChangeLog.
2. Only use the manager webapp to deploy your apps.
3. Disable auto-deploy AND only use the manager webapp to deploy your
webapps. This will prevent mid-copy deployments.
4. Stop Tomcat before deploying, which will solve everything :)

Hope that helps,
- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message