0 Replies Latest reply on May 10, 2012 8:36 AM by cedricceler

    Problems with resource injection in EJBs

    cedricceler Newbie

      Hi guys,

       

      Im having troubles to get my connection factory using annotation resource.

      It works well with the JNDI lookup but it does not with the annotation, my connection factory is null.

       

      This is my code with the JNDI lookup (works) :

       

      ConnectionFactory factory = (ConnectionFactory)context.lookup("/ConnectionFactory");

       

      This is my code with the annotation :

       

        /** The connection factory. */

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

        private ConnectionFactory factory;

       

       

      I ve tried with different mappedName as : /ConnectionFactory, java:/JmsXA, JmsXA etc. but still nullpointerexception :-/.

       

      If someone has an idea ...

       

      Thx !