6 Replies Latest reply on Jul 19, 2012 12:21 PM by Tor J. Johannessen

    Can not get @Inject to work on JBoss 6.1.0.Final

    Tor J. Johannessen Newbie

      I have a statleless session bean:



      public class TestBean {



          private Test test;



      an interface:


      public interface Test {



      and a managed bean that implements the interface:


      import javax.inject.Named;



      public class TestImpl implements Test {




      all classes are packaged in a war file in the WEB-INF/classes directory


      A beans.xml file is placed in the WEB-INF directory of test.war:


      <beans xmlns="http://java.sun.com/xml/ns/javaee"







      When TestBean is invoked, nothing is injected into the test field.


      I've also tried using a producer and an Instance, but again nothing is injected.


      The are no error messages in the server console, and the following traces of Weld can be found in the console:



      16:00:40,977 INFO  [JBossASKernel] installing bean: jboss.j2ee:ear=test.ear,jar=test.war,name=TestBean,service=EJB3

      16:00:40,979 INFO  [JBossASKernel]   with dependencies:

      16:00:40,982 INFO  [JBossASKernel]   and demands:

      16:00:40,984 INFO  [JBossASKernel]      jboss-injector:topLevelUnit=test.ear,unit=test.war,bean=TestBean; Required: Described

      16:00:40,985 INFO  [JBossASKernel]      jboss.ejb:service=EJBTimerService; Required: Described

      16:00:40,991 INFO  [JBossASKernel]      jboss-injector:topLevelUnit=test.ear,unit=test.war,bean=TestBean,interceptor=org.jboss.weld.integration.ejb.SessionBeanInterceptor; Required: Described

      16:00:40,993 INFO  [JBossASKernel]      jboss-injector:topLevelUnit=test.ear,unit=test.war,bean=TestBean,interceptor=org.jboss.weld.integration.ejb.interceptor.Jsr299BindingsInterceptor; Required: Described

      16:00:40,994 INFO  [JBossASKernel]      jboss-switchboard:appName=test,module=test; Required: Create

      16:00:40,998 INFO  [JBossASKernel]   and supplies:

      16:00:41,001 INFO  [JBossASKernel]      jndi:test/TestBean/local-Test

      16:00:41,007 INFO  [JBossASKernel]      jndi:test/TestBean/local

      16:00:41,008 INFO  [JBossASKernel]      Class:Test

      16:00:41,009 INFO  [JBossASKernel]      jndi:TestBean

      16:00:41,011 INFO  [JBossASKernel] Added bean(jboss.j2ee:ear=test.ear,jar=test.war,name=TestBean,service=EJB3) to KernelDeployment of: test.war


      16:00:41,288 INFO  [Version] WELD-000900 1.1.2 (Final)



      I can't figure out what the problem is. Has anyone got a clue?