Hi Chris,

Thanks for the reply. Let me try this out. But do you think its a bug in
Tomcat ? Because as an application developer I should be able to invoke
arbitrary application logic during the ServletFilter::destroy(...) method
without bothering about the class loading related issues (Note that the jar
files for these classes are available inside WEB-INF/lib directory and the
shutdown process completes successfully most of the times without raising
NoClassDefFoundErrors).

Please let me know.

Regards
Hrishikesh


On Fri, Feb 5, 2016 at 8:12 PM, Christopher Schultz <
ch...@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hrishikesh,
>
> On 2/5/16 6:57 PM, Hrishikesh Gadre wrote:
> > We are getting NoClassDefFoundErrors during Tomcat graceful
> > shutdown process (i.e. using "catalina.sh stop" command). We are
> > using Tomcat with version 6.0.44. Note that this error can not be
> > reproduced consistently. I found following article on the
> > stackoverflow.com which suggests class loader related problems
> > during execution of JVM shutdown hook. But in this case, the error
> > is raised during the execution of ServletFilter::destroy(...)
> > method. So I am not sure if article is relevant.
>
> This kind of thing usually happens because Tomcat marks the
> WebappClassLoader as "shutting down" and it won't load any new
> classes. So, if your shutdown code ends up requiring new classes, it
> could fail.
>
> Is this reproducible? If possible, can you write a
> ServletContextListener that will simply load the class in question
> (com.google.common.cache.RemovalCause) and do nothing else?
>
> If that solves the problem, then the root issue is what I described
> above (and may be replaced by a series of other classes for the same
> reason; just load them all as a test to see if this is what's happening.
> )
>
> It's not a great solution, but it might fix the problem and allow your
> application to shutdown (actually) gracefully.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAla1cp4ACgkQ9CaO5/Lv0PB7EACfQvNwIHoHT89yeSKgP4+Fff4n
> gYUAoLLgQkISwi0zueBXPT2cBXenYBRt
> =yGJb
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to