Bug 57122 - class loading during remote deployment not working (NoClassDefFoundError)
Summary: class loading during remote deployment not working (NoClassDefFoundError)
Status: RESOLVED DUPLICATE of bug 56321
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.53
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-21 11:50 UTC by michael.bauland
Modified: 2014-10-21 13:20 UTC (History)
0 users



Attachments
error log (4.62 KB, text/plain)
2014-10-21 12:21 UTC, michael.bauland
Details

Note You need to log in before you can comment on or make changes to this bug.
Description michael.bauland 2014-10-21 11:50:19 UTC
I have a Tomcat running a web application, which I then want to update remotely. During this deployment a ServletContextListener instance (called InitListener and configured in the web.xml) executes the contextDestroyed method.

In this method some java classes cannot be loaded. In the tomcat's error log I see errors like:

SEVERE: Exception sending context destroyed event to listener instance of class x.y.z.InitListener
java.lang.NoClassDefFoundError: org/jboss/netty/util/internal/ConcurrentHashMap$Values

However, if I access the same class (in this example the ConcurrentHashMap$Values) at some previous point before the shutdown starts, everything works fine.

It seems that Tomcat is not able to (newly) load the necessary classes when doing the shutdown part of the remote deployment. To my knowledge at this point arbitrary java code should still be executable.
Comment 1 Konstantin Kolinko 2014-10-21 12:02:07 UTC
(In reply to michael.bauland from comment #0)
> 
> SEVERE: Exception sending context destroyed event to listener instance of
> class x.y.z.InitListener
> java.lang.NoClassDefFoundError:
> org/jboss/netty/util/internal/ConcurrentHashMap$Values
> 

1. The full stack trace of the above error = ?

(Was "Exception sending context destroyed event" produced by Tomcat?
Was there a "root cause" of the above exception? What class loader was trying to load the class?
Any other preceding error in the logs?)

2. Are jboss classes in your web application's WEB-INF/lib and absent from Tomcat's lib directory?

3. Can you provide simple sample web application to reproduce this behaviour?
Comment 2 michael.bauland 2014-10-21 12:21:34 UTC
Created attachment 32132 [details]
error log
Comment 3 michael.bauland 2014-10-21 12:25:37 UTC
Thanks for the quick response. 
1. I have attached the full stack trace. There have been no preceding errors in 
the log, as you can see.

2. No, we do not use jBoss (just richfaces) and have no jBoss classes present.

3. Sorry, the classes that cannot be loaded seem to be arbitrary, one self-written utility class and one from the netty framework (org/jboss/netty/util/internal/ConcurrentHashMap$Values), but I can't reproduce with a simple sample.
Comment 4 Mark Thomas 2014-10-21 12:40:54 UTC
(In reply to michael.bauland from comment #3)
> Thanks for the quick response. 
> 1. I have attached the full stack trace. There have been no preceding errors
> in 
> the log, as you can see.
> 
> 2. No, we do not use jBoss (just richfaces) and have no jBoss classes
> present.
> 
> 3. Sorry, the classes that cannot be loaded seem to be arbitrary, one
> self-written utility class and one from the netty framework
> (org/jboss/netty/util/internal/ConcurrentHashMap$Values), but I can't
> reproduce with a simple sample.

Again, where are the classes that can't be loaded located?
Comment 5 Konstantin Kolinko 2014-10-21 12:42:52 UTC
See bug 56321. Update to 7.0.54 or later.

*** This bug has been marked as a duplicate of bug 56321 ***
Comment 6 Mark Thomas 2014-10-21 12:45:23 UTC
Looks like the classes are located in the web application. I was just about to mark this as a duplicate as well but Konstantin beat me to it.
Comment 7 michael.bauland 2014-10-21 13:20:34 UTC
Yes, sorry, didn't see you question about the location of the classes. They are located in the WEB-INF/lib folder.