4 Replies Latest reply on Jun 13, 2007 8:18 AM by Peter Bruhn

    @EJB inside EJB Session

    jmp jmp Newbie

      Hi,

      I would like to know if it is possible to inject an EJB inside an other one ?
      I tried with jboss 4.2 and it does not work :
      could not resolve global JNDI name for @EJB ..... at deployment time

      Thanks,

      Regards,

        • 1. Re: @EJB inside EJB Session
          Carlo de Wolf Master

          Yes, it works. Check for example the stateless unit test.

          @Stateless
          @SecurityDomain("other")
          @Remote(AnonymousStateless.class)
          public class AnonymousStatelessBean implements AnonymousStateless
          {
           private static final Logger log = Logger.getLogger(AnonymousStatelessBean.class);
          
           @EJB CheckedStateless stateless;
          
           public int method(int i) throws NamingException
           {
           return stateless.method(i);
           }
          }


          • 2. Re: @EJB inside EJB Session
            jmp jmp Newbie

            Thank you for your reply wolfc.
            I have tried but i have always the same error at deployment :

            Reason: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container TestDAO: reference class: daosession.VerifJaguarHibernateEJB3DAO
             ejbLink: not used by any EJBs


            TestDAO is an EJB which calls VerifJaguarHibernateEJB3DAO.

            If you have an idea, i will be very delighted.

            Regards,


            • 3. Re: @EJB inside EJB Session
              Carlo de Wolf Master

              Is the VerifJahuarHibernateEJB3DAO bean properly deployed within either the same jar or the same ear?

              • 4. Re: @EJB inside EJB Session
                Peter Bruhn Newbie

                Could it be that daosession.VerifJaguarHibernateEJB3DAO is an interface and you have not deployed the implementation of this interface as well inside this deployment unit?

                Peter