|Summary:||class loading during remote deployment not working (NoClassDefFoundError)|
|Component:||Catalina||Assignee:||Tomcat Developers Mailing List <dev>|
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 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
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.