1 Reply Latest reply on Mar 22, 2011 10:57 AM by Ales Justin

    Servlet constructor injection fails on JBoss AS6.x

    l. karlsen Newbie
      I'm trying to inject a simple managed bean into my servlet using constructor injection with no luck.
      I can inject the bean using field injection but constuctor injection fails with the stacktrace below.
      I've tried jboss 6.0 and the latest 6.1 SNAPSHOT and get the same error. This works on glassfish 3.1.

      Weld bug?

      10:47:32,732 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/sample.webapp].[SimpleServlet]] Allocate exception for servlet SimpleServlet: java.lang.InstantiationException: no.linus.sample.webapp.SimpleServlet
              at java.lang.Class.newInstance0(Class.java:340) [:1.6.0_24]
              at java.lang.Class.newInstance(Class.java:308) [:1.6.0_24]
              at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:279) [:6.1.0-SNAPSHOT]
              at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:263) [:6.1.0-SNAPSHOT]
              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1162) [:]
              at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:955) [:]
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [:]
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:]
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0-SNAPSHOT]
              at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
              at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0-SNAPSHOT]
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0-SNAPSHOT]
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:]
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:]
              at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0-SNAPSHOT]
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:]
              at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0-SNAPSHOT]
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:]
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:]
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:]
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]