Tomcat Throws an Exception When Finishing a Spring Boot Application

Sometimes when Tomcat has been running for a while and I terminate the embeded Tomcat (Ctrl+c) the application throws the following exception:

2019-10-17 10:23:10.704 INFO 20020 --- [ Thread-3] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'entityManagerFactory': java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: org/springframework/orm/hibernate5/SpringBeanContainer$SpringContainedBean Exception in thread "Thread-3" java.lang.NoClassDefFoundError: org/apache/catalina/Lifecycle$SingleUse at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:269) at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:466) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stopTomcat(TomcatWebServer.java:254) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stop(TomcatWebServer.java:309) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.stopAndReleaseWebServer(ServletWebServerApplicationContext.java:305) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onClose(ServletWebServerApplicationContext.java:171) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1032) at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:945)

It seems that the exception is thrown when Tomcat has been running for a long time and my application has not been used.

I checked my application jar file and spring-orm-5.1.8.RELEASE.jar is embeded and the class org/springframework/orm/hibernate5/SpringBeanContainer is there.

Any idea is apreciated.

2

1 Answer

Try to shutdown the application before replacing or renaming the jar.

@see Graceful shutdown fails

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest