Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0-alpha-1, 3.8.2, 3.8.3
-
Apply to all environments
Description
Reloading a web application with maven-jetty-plugin 9.4.43.v20210629, 9.4.44.v20210927 or 11.0.6 (at least) is failing when executing with apache maven 3.8.2 or 3.8.3, but it worked fine with maven 3.8.1.
Error is different with maven-jetty-plugin 9.x vs 11.x ,but in both cases, the base error is due to java.lang.ClassNotFoundException error (different classes in each case, but classes which can be correctly loaded with starting the web context the first time). Error occurs when ENTER (default key for web context restart) is typed.
NOTE: I had created an incidence for the jetty plugin (see 6977) but after analyzing it, it was closed pointing to a core issue.
Steps to reproduce:
I have attached a simple Apache Maven project with two submodules presenting the fail in a very simple scenario:
- Subsytem test-project-util defines a class extending HttpServlet
- Subsystem test-project-service defines a class HelloServlet extending the class in the test-project-util subsystem
NOTE: In the jax-rs project, error is different, but probably the cause is the same.
Steps to reproduce the issue:
- unzip test-project.zip file
- cd test-project
- mvn install
- cd test-project-service
- mvn jetty:run
- ENTER (to reload application)
After this, the following exception is raised
{{[INFO] restarting o.e.j.m.p.JettyWebAppContext@55fee662{WS Test Service,/test-project-service,file:///D://test-project/test-project-service/src/main/webapp/,AVAILABLE}
[INFO] Stopped o.e.j.m.p.JettyWebAppContext@55fee662{WS Test Service,/test-project-service,file:///D://test-project/test-project-service/src/main/webapp/,STOPPED}
{file:///D:/test-project/test-project-service/src/main/webapp/}[INFO] Webapp source directory = D:\\test-project\test-project-service\src\main\webapp
[INFO] Reload Mechanic: manual
[INFO] nonBlocking:false
[INFO] Classes = D:\\test-project\test-project-service\target\classes
[INFO] Context path = /test-project-service
[INFO] Tmp directory = D:\\test-project\test-project-service\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = file:///D://test-project/test-project-service/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\\test-project\test-project-service\src\main\webapp
[INFO] Scanning elapsed time=12ms
[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@55fee662{WS Test Service,/test-project-service,file:///D://test-project/test-project-service/src/main/webapp/,UNAVAILABLE}
java.lang.NoClassDefFoundError: es/testproject/SimpleRestHttpServletTemplate
at java.lang.ClassLoader.defineClass1 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java:1017)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:174)
at java.net.URLClassLoader.defineClass (URLClassLoader.java:550)
at java.net.URLClassLoader$1.run (URLClassLoader.java:458)
at java.net.URLClassLoader$1.run (URLClassLoader.java:452)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (URLClassLoader.java:451)
at org.eclipse.jetty.webapp.WebAppClassLoader.foundClass (WebAppClassLoader.java:642)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadAsResource (WebAppClassLoader.java:615)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass (WebAppClassLoader.java:529)
at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
at org.eclipse.jetty.util.Loader.loadClass (Loader.java:64)
at org.eclipse.jetty.servlet.BaseHolder.doStart (BaseHolder.java:89)
at org.eclipse.jetty.servlet.ServletHolder.doStart (ServletHolder.java:369)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0 (ServletHandler.java:730)
at java.util.stream.SortedOps$SizedRefSortingSink.end (SortedOps.java:357)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining (StreamSpliterators.java:312)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining (Streams.java:735)
at java.util.stream.ReferencePipeline$Head.forEach (ReferencePipeline.java:658)
at org.eclipse.jetty.servlet.ServletHandler.initialize (ServletHandler.java:755)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:379)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp (WebAppContext.java:1449)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp (JettyWebAppContext.java:328)
at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1414)
at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:910)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:288)
at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:524)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart (JettyWebAppContext.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.restartWebApp (JettyRunMojo.java:468)
at org.eclipse.jetty.maven.plugin.ConsoleScanner.restartWebApp (ConsoleScanner.java:114)
at org.eclipse.jetty.maven.plugin.ConsoleScanner.checkSystemInput (ConsoleScanner.java:78)
at org.eclipse.jetty.maven.plugin.ConsoleScanner.run (ConsoleScanner.java:46)
Caused by: java.lang.ClassNotFoundException: es.testproject.SimpleRestHttpServletTemplate
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass (SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass (ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass (ClassRealm.java:239)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass (WebAppClassLoader.java:538)
at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
at java.lang.ClassLoader.defineClass1 (Native Method)
at java.lang.ClassLoader.defineClass (ClassLoader.java:1017)
at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:174)
at java.net.URLClassLoader.defineClass (URLClassLoader.java:550)
at java.net.URLClassLoader$1.run (URLClassLoader.java:458)
at java.net.URLClassLoader$1.run (URLClassLoader.java:452)
at java.security.AccessController.doPrivileged (Native Method)
at java.net.URLClassLoader.findClass (URLClassLoader.java:451)
at org.eclipse.jetty.webapp.WebAppClassLoader.foundClass (WebAppClassLoader.java:642)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadAsResource (WebAppClassLoader.java:615)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass (WebAppClassLoader.java:529)
at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
at org.eclipse.jetty.util.Loader.loadClass (Loader.java:64)
at org.eclipse.jetty.servlet.BaseHolder.doStart (BaseHolder.java:89)
at org.eclipse.jetty.servlet.ServletHolder.doStart (ServletHolder.java:369)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0 (ServletHandler.java:730)
at java.util.stream.SortedOps$SizedRefSortingSink.end (SortedOps.java:357)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:474)
at java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining (StreamSpliterators.java:312)
at java.util.stream.Streams$ConcatSpliterator.forEachRemaining (Streams.java:735)
at java.util.stream.ReferencePipeline$Head.forEach (ReferencePipeline.java:658)
at org.eclipse.jetty.servlet.ServletHandler.initialize (ServletHandler.java:755)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:379)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp (WebAppContext.java:1449)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp (JettyWebAppContext.java:328)
at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1414)
at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:910)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:288)
at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:524)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart (JettyWebAppContext.java:397)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:73)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.restartWebApp (JettyRunMojo.java:468)
at org.eclipse.jetty.maven.plugin.ConsoleScanner.restartWebApp (ConsoleScanner.java:114)
at org.eclipse.jetty.maven.plugin.ConsoleScanner.checkSystemInput (ConsoleScanner.java:78)
at org.eclipse.jetty.maven.plugin.ConsoleScanner.run (ConsoleScanner.java:46)
[INFO] Restart completed at Mon Oct 11 11:32:24 CEST 2021}}
Attachments
Attachments
Issue Links
- is fixed by
-
MNG-7312 Revert ThreadLocal approach from MNG-6843 and MNG-7251
- Closed