2 Replies Latest reply on Jun 14, 2007 10:38 AM by Esclarmonde Trencs

    EJB Injection Question

    Esclarmonde Trencs Newbie

      Hello,

      I have only recently started working with JBoss and EJB 3.0. Maybe I am missing something obvious. I have a stateless session bean which has to reference several other stateless session beans.

      Now my resources suggest that I use the @EJB annotation to achieve this.

      @Stateless
      @Local(XLocal.class)
      public class XBean implements X {
      
       @EJB YLocal y;
       ....
      
      }
      
      @Stateless
      @Local(YLocal .class)
      public class YBean implements Y {
       ....
      }
      


      Where XLocal and YLocal extend the X,Y interfaces ...

      The injection in the XBean is not working. There are no error messages on deployment that look like they are related to this. Only "Incomplete Deployment listing" on a different MBean (probably a completely unrelated problem).

      I used to use something like
      Context c = new InitialContext();
      return (YLocal) c.lookup(".../YBean/local");
      


      This has worked fine in the past. Now I wonder why the @EJB annotation is not working, as it looks easier to maintain.

      I would be very grateful for some hints what I am missing here.

      Bye
      Esclarmonde