- All Implemented Interfaces:
- EventListener, javax.servlet.ServletContextListener
public class StripersistCleanupListener
extends Object
implements javax.servlet.ServletContextListener
Explicitly calls Stripersist.cleanup() when the context is destroyed, so that
it isn't only called later on when the Stripersist finalizer is invoked, which
may lead to the following exception:
INFO: Illegal access: this web application instance has been stopped already. Could not load org.hibernate.event.EventListeners$2. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1564)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.hibernate.event.EventListeners.destroyListeners(EventListeners.java:215)
at org.hibernate.impl.SessionFactoryImpl.close(SessionFactoryImpl.java:972)
at org.hibernate.ejb.EntityManagerFactoryImpl.close(EntityManagerFactoryImpl.java:127)
at org.stripesstuff.stripersist.Stripersist.cleanup(Stripersist.java:501)
at org.stripesstuff.stripersist.Stripersist.finalize(Stripersist.java:511)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)
- Author:
- matthijsln