You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sam Zilverberg <sa...@gmail.com> on 2011/01/13 14:47:10 UTC

app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Hi,

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.

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?
Do you have any ideas on what is causing this or what I can do to diagnose
this problem?
I'm clueless at the moment :(

Thanks
-Sam

Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by André Warnier <aw...@ice-sa.com>.
user080701 wrote:
> How to unsubscribe this email ?

Scroll to the end (all thr way down there), and follow the instructions.

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


Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by user080701 <us...@hotmail.com>.
How to unsubscribe this email ?

--------------------------------------------------
From: "Sam Zilverberg" <sa...@gmail.com>
Sent: Thursday, January 13, 2011 9:47 PM
To: "tomcat" <us...@tomcat.apache.org>
Subject: app throws java.lang.NoClassDefFoundError sometimes, and sometimes 
it doesnt

> Hi,
>
> 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.
>
> 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?
> Do you have any ideas on what is causing this or what I can do to diagnose
> this problem?
> I'm clueless at the moment :(
>
> Thanks
> -Sam
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus 
> signature database 5783 (20110113) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
> 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 5783 (20110113) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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


Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sam,

On 1/19/2011 11:12 AM, Sam Zilverberg wrote:
> We changed cp to mv and there are no problems now :)

I thought of another strategy: ln

If you use a hard link, you get to keep the file in the old location and
in the new location. You also don't have to worry about whether Tomcat
will complain about symlinks.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk03FfIACgkQ9CaO5/Lv0PCOVACgkgJ3XrL76btAgGycAP2akUBo
6QkAn23Kj8ZCXQZF3dDJMD934MXhRZIi
=0cch
-----END PGP SIGNATURE-----

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


Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by Sam Zilverberg <sa...@gmail.com>.
We changed cp to mv and there are no problems now :)

Thanks for the help

On Thu, Jan 13, 2011 at 8:16 PM, Sam Zilverberg <sa...@gmail.com>wrote:

> We copy using cp...
> I'll try some of the ideas you guys mentioned and reply sometime next week
> after I have some results.
> Thanks for the great ideas !
>
> -Sam
>

Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by Sam Zilverberg <sa...@gmail.com>.
We copy using cp...
I'll try some of the ideas you guys mentioned and reply sometime next week
after I have some results.
Thanks for the great ideas !

-Sam

RE: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

> 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 :)

Or copy the .war file with a different extension, then rename the file once it is completely transferred.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by Mark Thomas <ma...@apache.org>.
On 13/01/2011 15:47, Christopher Schultz wrote:
> 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
If done via the Manager interface this will never be an issue. The
Manager does a few extra things to protect against this. If you do scp
or similar then you might hit the issue.

Mark

> 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

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



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


Re: app throws java.lang.NoClassDefFoundError sometimes, and sometimes it doesnt

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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