Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3531

If jetty-utils is on the class path, resteasy-undertow-cdi will fail to process requests

XMLWordPrintable

      If the org.eclipse.jetty:jetty-util library is on the class path when you attempt to use the org.jboss.resteasy:resteasy-undertow-cdi embedded server or via SeBootstrap, a boot failure occurs.

      java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/handler/ContextHandler$Context
      	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
      	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
      	at dev.resteasy.examples.multipart.UploadTestCase.startInstance(UploadTestCase.java:50)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
      	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
      Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/handler/ContextHandler$Context
      	at org.jboss.weld.environment.jetty.LegacyWeldDecorator.process(LegacyWeldDecorator.java:47)
      	at org.jboss.weld.environment.jetty.JettyLegacyContainer.initialize(JettyLegacyContainer.java:56)
      	at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:207)
      	at org.jboss.weld.environment.servlet.Listener.contextInitialized(Listener.java:120)
      	at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
      	at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:219)
      	at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187)
      	at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
      	at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
      	at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255)
      	at dev.resteasy.embedded.server.UndertowCdiEmbeddedServer.start(UndertowCdiEmbeddedServer.java:76)
      	at org.jboss.resteasy.core.se.ResteasySeInstance.lambda$create$5(ResteasySeInstance.java:156)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
      	at org.jboss.resteasy.concurrent.ContextualExecutors.lambda$runnable$2(ContextualExecutors.java:312)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
      	at java.base/java.lang.Thread.run(Thread.java:1583)
      Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.handler.ContextHandler$Context
      	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
      	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
      	... 17 more
      

      This can happen when trying to use the org.jboss.resteasy:resteasy-client-jetty as the backing client engine.

      The simple fix for this is to tell Weld to always use the org.jboss.weld.environment.undertow.UndertowContainer Weld Container.

              jperkins-rhn James Perkins
              jperkins-rhn James Perkins
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: