-
Enhancement
-
Resolution: Won't Do
-
Minor
-
None
-
2.4.0.Final
-
None
When we run the Apache Camel example with Weld, CDI and Jetty, we see this exception
2016-09-15 14:54:46,451 [main ] ERROR servletTomcat - WELD-ENV-001102: Unable to replace Tomcat 7 AnnotationProcessor. CDI injection will not be available in Servlets, Filters, or Listeners.
java.lang.RuntimeException: WELD-ENV-001104: Cannot get StandardContext from ServletContext.
at org.jboss.weld.environment.tomcat.WeldForwardingInstanceManager.getStandardContext(WeldForwardingInstanceManager.java:104) ~[weld-servlet-2.4.0.Final.jar:2.4.0.Final]
at org.jboss.weld.environment.tomcat.WeldForwardingInstanceManager.replaceInstanceManager(WeldForwardingInstanceManager.java:84) ~[weld-servlet-2.4.0.Final.jar:2.4.0.Final]
at org.jboss.weld.environment.tomcat.TomcatContainer.initialize(TomcatContainer.java:43) [weld-servlet-2.4.0.Final.jar:2.4.0.Final]
at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:216) [weld-servlet-2.4.0.Final.jar:2.4.0.Final]
at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:61) [weld-servlet-2.4.0.Final.jar:2.4.0.Final]
at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140) [jetty-plus-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:65) [jetty-annotations-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:274) [jetty-servlet-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349) [jetty-webapp-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp(JettyWebAppContext.java:297) [jetty-maven-plugin-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342) [jetty-webapp-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505) [jetty-webapp-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:366) [jetty-maven-plugin-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:163) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.Server.start(Server.java:387) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.server.Server.doStart(Server.java:354) [jetty-server-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.maven.plugin.JettyServer.doStart(JettyServer.java:73) [jetty-maven-plugin-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [jetty-util-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:535) [jetty-maven-plugin-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:358) [jetty-maven-plugin-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:167) [jetty-maven-plugin-9.2.17.v20160517.jar:9.2.17.v20160517]
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) [maven-core-3.2.5.jar:3.2.5]
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) [maven-embedder-3.2.5.jar:3.2.5]
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216) [maven-embedder-3.2.5.jar:3.2.5]
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160) [maven-embedder-3.2.5.jar:3.2.5]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_31]
at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_31]
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) [plexus-classworlds-2.5.2.jar:?]
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) [plexus-classworlds-2.5.2.jar:?]
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) [plexus-classworlds-2.5.2.jar:?]
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [plexus-classworlds-2.5.2.jar:?]
Caused by: java.lang.ClassCastException: org.eclipse.jetty.webapp.WebAppContext$Context cannot be cast to org.apache.catalina.core.ApplicationContextFacade
at org.jboss.weld.environment.tomcat.WeldForwardingInstanceManager.getStandardContext(WeldForwardingInstanceManager.java:101) ~[weld-servlet-2.4.0.Final.jar:2.4.0.Final]
... 55 more
It would maybe be nice to avoid the nasty stacktrace and do a single line logging at WARN level.
The example
https://github.com/apache/camel/tree/master/examples/camel-example-cdi-rest-servlet
To run
mvn jetty:run
- is related to
-
WELD-1710 weld-servlet detects tomcat container when used in jetty 9.2
- Resolved