5 Replies Latest reply on Jul 20, 2011 10:11 AM by Torsten Fink

    Problems with resource injection in EJBs

    Torsten Fink Newbie

      I am playing with JMS in AS7 and I know that the integration is not finished yet. But, I stumbled over an issue that is probably unrelated to JMS (and one that is).

       

      First I tried to inject the resources using @Resource

       

      [code]

          @Resource(mappedName = "jms-prototype")

          private Queue queue;

       

           @Resource(mappedName = "java:/ConnectionFactory")

          private QueueConnectionFactory connectionFactory;

      [code]

       

      That did not work, because at deployment the appserver complains that it cannot resolve the dependencies:

       

      [code]

      {"Services with missing/unavailable dependencies" => ["jboss.deployment.subunit.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT.ear\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT.jar\".component.MessageSenderBean.START missing [ jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.\"env/de.akquinet.jbosscc.as7eval.jmsprototype.ejb.MessageSenderBean/connectionFactory\", jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.\"env/de.akquinet.jbosscc.as7eval.jmsprototype.ejb.MessageSenderBean/queue\" ]","jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.\"env/de.akquinet.jbosscc.as7eval.jmsprototype.ejb.MessageSenderBean/connectionFactory\".jboss.deployment.subunit.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT.ear\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT.jar\".component.MessageSenderBean.9 missing [ jboss.naming.context.java.ConnectionFactory ]","jboss.deployment.subunit.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT.ear\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT.jar\".jndiDependencyService missing [ jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.\"env/de.akquinet.jbosscc.as7eval.jmsprototype.ejb.MessageSenderBean/connectionFactory\", jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.\"env/de.akquinet.jbosscc.as7eval.jmsprototype.ejb.MessageSenderBean/queue\" ]","jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.\"env/de.akquinet.jbosscc.as7eval.jmsprototype.ejb.MessageSenderBean/queue\".jboss.deployment.subunit.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT.ear\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT.jar\".component.MessageSenderBean.8 missing [ jboss.naming.context.java.comp.\"as7-jms-prototype-ear-0.0.1-SNAPSHOT\".\"as7-jms-prototype-ejb-0.0.1-SNAPSHOT\".MessageSenderBean.env/jms-prototype ]"]}

      [code]

       

      But, If I look up the resources programmatically it works:

       

      [code]

           final InitialContext initialContext = new InitialContext();

           queue = (Queue) initialContext.lookup("jms-prototype");

           connectionFactory = (QueueConnectionFactory) initialContext.lookup("java:/ConnectionFactory");

      [code]

       

      So, is the resource injection of EJBs not working yet?