Open kingston-csj opened 2 weeks ago
Hello,
Spring Boot 3.0.9 isn't OSS supported anymore. Please upgrade to a supported version and if it still happens, please share a minimal reproducer (it's okay if it doesn't happen every time). I'll then re-open this issue.
Could also be a duplicate of https://github.com/spring-projects/spring-boot/issues/40096.
Thanks!
My Jdk version is 17. I have upgraded my springboot version to 3.2.5, but the problem still exists. I don't know the specific reproduction method, but one thing is certain: if the program is closed immediately after starting, there will be no problem. But if I restart after a few hours, the following error is reported:
2024-10-30 09:02:39 25091823 [SpringApplicationShutdownHook] WARN o.s.c.s.DefaultLifecycleProcessor - Failed to stop bean 'webServerGracefulShutdown'
java.lang.NoClassDefFoundError: org/springframework/boot/web/server/GracefulShutdownCallback
at org.springframework.boot.web.context.WebServerGracefulShutdownLifecycle.stop(WebServerGracefulShutdownLifecycle.java:62)
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:348)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:487)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:317)
at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:218)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1139)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1093)
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.server.GracefulShutdownCallback
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:104)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 13 common frames omitted
2024-10-30 09:03:09 25121828 [SpringApplicationShutdownHook] INFO o.s.c.s.DefaultLifecycleProcessor - Shutdown phase 2147482623 ends with 1 bean still running after timeout of 30000ms: [webServerGracefulShutdown]
2024-10-30 09:03:09 25121831 [SpringApplicationShutdownHook] WARN o.s.c.s.DefaultLifecycleProcessor - Failed to stop bean 'webServerStartStop'
java.lang.NoClassDefFoundError: org/apache/catalina/Lifecycle$SingleUse
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:254)
at org.apache.catalina.core.StandardService.removeConnector(StandardService.java:298)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.lambda$removeServiceConnectors$1(TomcatWebServer.java:171)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.doWithConnectors(TomcatWebServer.java:190)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.removeServiceConnectors(TomcatWebServer.java:168)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stop(TomcatWebServer.java:354)
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.stop(WebServerStartStopLifecycle.java:53)
at org.springframework.context.SmartLifecycle.stop(SmartLifecycle.java:117)
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:348)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:487)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:317)
at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:218)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1139)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1093)
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.Lifecycle$SingleUse
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:104)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 20 common frames omitted
Thanks for help.
Could you please try with Spring Boot 3.2.11?
Could you please try with Spring Boot 3.2.11?
OK, I'll give it a try. I'll run the program for a few hours and see the results tomorrow.
I upgraded springboot's version to 3.2.11. After running the program for 13 hours, I just restarted it and there won't be any errors. I will observe for a few more days. Many thanks.
This error occurred in the Amazon Linux environment, and it has never occurred in Windows or Ubuntu. I am not sure if it is related to the operating system.
@kingston-csj are you saying you're now observing the error again? Or does your previous comment about an upgrade fixing it still stand?
Sorry, I didn't express clearly. I just wanted to supplement the operating environment that previously reported errors. After the upgrade, there will be no problems on any operating system. @philwebb
Today i found this error occured agin after running for a week. My os is amazon linux 2023. My other operating systems, Windows and Ubuntu, do not experience this error. The error messages in versions 3.2.5 and 3.2.11 are not exactly the same. The 3.2.5 version is shown as https://github.com/spring-projects/spring-boot/issues/42923#issuecomment-2446361233, which has a timeout block ‘ Failed to shut down 1 bean with phase value 2147482623 within timeout of 30000ms’.
The 3.2.11 version ,however, occured 'NoClassDefFoundError' exception without timeout block. Here's the exception stack info.
2024-11-15 09:59:58 591449166 [Thread-1] INFO org.tea.editor.server.Startup - app begin to shut down
2024-11-15 09:59:58 591449168 [Thread-1] INFO o.t.e.server.cache.AsyncDbService - db service shutdown ok
2024-11-15 09:59:58 591449173 [SpringApplicationShutdownHook] WARN o.s.c.s.DefaultLifecycleProcessor - Failed to stop bean 'webServerGracefulShutdown'
java.lang.NoClassDefFoundError: org/springframework/boot/web/server/GracefulShutdownCallback
at org.springframework.boot.web.context.WebServerGracefulShutdownLifecycle.stop(WebServerGracefulShutdownLifecycle.java:62)
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:346)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:488)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:315)
at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:215)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1148)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1102)
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.server.GracefulShutdownCallback
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:104)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 13 common frames omitted
2024-11-15 09:59:58 591449177 [SpringApplicationShutdownHook] WARN o.s.c.s.DefaultLifecycleProcessor - Failed to stop bean 'webServerStartStop'
java.lang.NoClassDefFoundError: org/apache/catalina/Lifecycle$SingleUse
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:243)
at org.apache.catalina.core.StandardService.removeConnector(StandardService.java:299)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.lambda$removeServiceConnectors$1(TomcatWebServer.java:171)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.doWithConnectors(TomcatWebServer.java:190)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.removeServiceConnectors(TomcatWebServer.java:168)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stop(TomcatWebServer.java:354)
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.stop(WebServerStartStopLifecycle.java:53)
at org.springframework.context.SmartLifecycle.stop(SmartLifecycle.java:117)
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:346)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:488)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:315)
at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:215)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1148)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1102)
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.Lifecycle$SingleUse
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:104)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 20 common frames omitted
2024-11-15 09:59:58 591449179 [SpringApplicationShutdownHook] WARN o.s.c.s.DefaultLifecycleProcessor - Failed to stop bean 'redisConnectionFactory'
java.lang.NoClassDefFoundError: io/netty/channel/AbstractChannelHandlerContext$11
at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:735)
at io.netty.channel.AbstractChannelHandlerContext.close(AbstractChannelHandlerContext.java:560)
at io.netty.channel.DefaultChannelPipeline.close(DefaultChannelPipeline.java:906)
at io.netty.channel.AbstractChannel.close(AbstractChannel.java:243)
at io.lettuce.core.protocol.DefaultEndpoint.closeAsync(DefaultEndpoint.java:602)
at io.lettuce.core.protocol.CommandExpiryWriter.closeAsync(CommandExpiryWriter.java:148)
at io.lettuce.core.RedisChannelHandler.closeAsync(RedisChannelHandler.java:179)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionProvider.releaseAsync(LettuceConnectionProvider.java:87)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionProvider.release(LettuceConnectionProvider.java:74)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.release(LettuceConnectionFactory.java:1777)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.lambda$resetConnection$2(LettuceConnectionFactory.java:1593)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.lambda$doInLock$20(LettuceConnectionFactory.java:1459)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.doInLock(LettuceConnectionFactory.java:1469)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.doInLock(LettuceConnectionFactory.java:1458)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.resetConnection(LettuceConnectionFactory.java:1588)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.lambda$resetConnection$1(LettuceConnectionFactory.java:1136)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.lambda$doInLock$20(LettuceConnectionFactory.java:1459)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.doInLock(LettuceConnectionFactory.java:1469)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.doInLock(LettuceConnectionFactory.java:1458)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.resetConnection(LettuceConnectionFactory.java:1133)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.stop(LettuceConnectionFactory.java:901)
at org.springframework.context.SmartLifecycle.stop(SmartLifecycle.java:117)
at org.springframework.context.support.DefaultLifecycleProcessor.doStop(DefaultLifecycleProcessor.java:346)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.stop(DefaultLifecycleProcessor.java:488)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.stopBeans(DefaultLifecycleProcessor.java:315)
at org.springframework.context.support.DefaultLifecycleProcessor.onClose(DefaultLifecycleProcessor.java:215)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1148)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1102)
at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: io.netty.channel.AbstractChannelHandlerContext$11
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:104)
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 45 common frames omitted
2024-11-15 09:59:58 591449183 [SpringApplicationShutdownHook] WARN o.s.b.f.s.DisposableBeanAdapter - Custom destroy method 'shutdown' on bean with name 'lettuceClientResources' propagated an exception: java.lang.NoClassDefFoundError: io/netty/util/concurrent/ImmediateEventExecutor
2024-11-15 09:59:58 591449188 [SpringApplicationShutdownHook] WARN o.s.b.f.s.DisposableBeanAdapter - Invocation of close method failed on bean with name 'httpClient': java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingHttpClientConnectionManager$2
2024-11-15 09:59:58 591449192 [SpringApplicationShutdownHook] WARN o.s.b.f.s.DisposableBeanAdapter - Invocation of close method failed on bean with name 'mongo': java.lang.NoClassDefFoundError: com/mongodb/internal/binding/StaticBindingContext
2024-11-15 10:00:31 1099 [background-preinit] INFO o.h.validator.internal.util.Version - HV000001: Hibernate Validator 8.0.1.Final
2024-11-15 10:00:32 1192 [main] INFO org.xxx.Startup - **Starting** Startup using Java 17 with PID 2769571
The last sentence showed the app started again. Thanks for help!
@mhalbritter
The 3.2.5 version ,however, occured 'NoClassDefFoundError' exception without timeout block.
Is the stacktrace shown above from 3.2.5 or from 3.2.11?
The 3.2.5 version ,however, occured 'NoClassDefFoundError' exception without timeout block.
Is the stacktrace shown above from 3.2.5 or from 3.2.11?
Yes, I have upgraded springboot's version to 3.2.11. The stacktrace shown above is 3.2.11
Thanks.
I guess there's a bug somewhere in our loader.
You could try to switch to the old uber jar implementation and see if that works: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.2-Release-Notes#nested-jar-support
Ok, do I only need to update my pom.xml like this?
I need to wait until the next version maintenance and take some time to check the running status of the version. Thanks.
Yeah, that should do it.
Ok, I'll have a try
my springboot version is 3.0.9. when I use Lininx shell 'kill -15 pid' to kill my java application, it reported some exception like these:
This error doesn't happen every time, it just happens occasionally, and I don't even know how to reproduce this problem. I am very certain that this class 'org.springframework.boot.web.server.GracefulShutdownCallback' exists.
Thanks for help.