Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError for several Jetty classes on Javalin#stop #2240

Closed
zefir-git opened this issue May 9, 2024 · 2 comments
Closed

NoClassDefFoundError for several Jetty classes on Javalin#stop #2240

zefir-git opened this issue May 9, 2024 · 2 comments
Labels

Comments

@zefir-git
Copy link

zefir-git commented May 9, 2024

Actual behavior (the bug)
When calling Javalin#stop() sometimes the following error is thrown:

[io.javalin.Javalin] Javalin failed to stop gracefully
org.eclipse.jetty.util.MultiException: Multiple exceptions
	at org.eclipse.jetty.util.MultiException.ifExceptionThrow(MultiException.java:117)
	at org.eclipse.jetty.server.Server.doStop(Server.java:531)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
	at io.javalin.jetty.JettyServer.stop(JettyServer.kt:134)
	at io.javalin.Javalin.stop(Javalin.java:149)
        (...)
	Suppressed: java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections
		at org.eclipse.jetty.io.ManagedSelector.doStop(ManagedSelector.java:135)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.io.SelectorManager.doStop(SelectorManager.java:280)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.server.AbstractConnector.doStop(AbstractConnector.java:425)
		at org.eclipse.jetty.server.AbstractNetworkConnector.doStop(AbstractNetworkConnector.java:82)
		at org.eclipse.jetty.server.ServerConnector.doStop(ServerConnector.java:240)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.server.Server.doStop(Server.java:506)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at io.javalin.jetty.JettyServer.stop(JettyServer.kt:134)
		at io.javalin.Javalin.stop(Javalin.java:149)
	Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.io.ManagedSelector$CloseConnections
		... 35 more
		(...)
	Suppressed: java.lang.NoClassDefFoundError: org/eclipse/jetty/servlet/BaseHolder$Wrapped
		at org.eclipse.jetty.servlet.BaseHolder.unwrap(BaseHolder.java:276)
		at org.eclipse.jetty.servlet.ServletHolder.predestroyServlet(ServletHolder.java:466)
		at org.eclipse.jetty.servlet.ServletHolder.destroyInstance(ServletHolder.java:452)
		at org.eclipse.jetty.servlet.ServletHolder.doStop(ServletHolder.java:432)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.servlet.ServletHandler.doStop(ServletHandler.java:282)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:97)
		at org.eclipse.jetty.server.session.SessionHandler.doStop(SessionHandler.java:497)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:97)
		at org.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:1036)
		at org.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:399)
		at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:1084)
		at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:312)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:97)
		at org.eclipse.jetty.server.handler.StatisticsHandler.doStop(StatisticsHandler.java:261)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:97)
		at org.eclipse.jetty.server.Server.doStop(Server.java:517)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at io.javalin.jetty.JettyServer.stop(JettyServer.kt:134)
		at io.javalin.Javalin.stop(Javalin.java:149)
                (...)
	Suppressed: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/ReservedThreadExecutor$ReservedThread
		at org.eclipse.jetty.util.thread.ReservedThreadExecutor.doStop(ReservedThreadExecutor.java:197)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.util.thread.QueuedThreadPool.doStop(QueuedThreadPool.java:236)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:182)
		at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:205)
		at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:97)
		at org.eclipse.jetty.server.Server.doStop(Server.java:517)
		at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
		at io.javalin.jetty.JettyServer.stop(JettyServer.kt:134)
		at io.javalin.Javalin.stop(Javalin.java:149)
                (...)
io.javalin.util.JavalinException: MultiException[java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/io/ManagedSelector$CloseConnections, java.lang.NoClassDefFoundError: org/eclipse/jetty/servlet/BaseHolder$Wrapped, java.lang.NoClassDefFoundError: org/eclipse/jetty/util/thread/ReservedThreadExecutor$ReservedThread]
	at io.javalin.jetty.JettyServer.stop(JettyServer.kt:138)
	at io.javalin.Javalin.stop(Javalin.java:149)
        (...)

(some lines and repeated stack traces truncated)

Expected behavior
Should stop gracefully

To Reproduce
called Javalin#stop()
pom dependency added as:

<dependency>
            <groupId>io.javalin</groupId>
            <artifactId>javalin</artifactId>
            <version>6.1.3</version>
        </dependency>

Additional context
Does not happen always.

@tipsy
Copy link
Member

tipsy commented May 9, 2024

@zefir-git are you using Jetty 11 ? Please check your dependency tree.

@tipsy tipsy added the QUESTION label May 13, 2024
@zefir-git
Copy link
Author

I think I only encounter this problem when I rebuild my jar while it's still running and then shutting down. Perhaps that prevents it from loading these classes (as the jar was changed).

Not sure if that's how class loading is handled. Will do some more testing and re-open if the cause turns out to be something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants