tomcat-users mailing list archives

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

Sam,

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

Upgrade!

> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0vHqoACgkQ9CaO5/Lv0PDAdACeNQp/L6ZVaHl7zGv/jeDTwB/M
uvwAoK4rB5OVlq4PzbhVqQbnEQOac699
=KsuS
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message