2 Replies Latest reply on Apr 13, 2006 3:55 PM by mrhightech

    Problem with Embeddable EJB3

    mrhightech

      I have a stateless bean that I deploy and can lookup in a standard JBoss install. I try to test it with the embeddable ejb3 edition and the lookup returns null.

      now... Just to make sure I am not missing something obvious.

      I have @Resource EJBContext ctx;

      ...

      ctx.lookup("ObjectName/local") <-- returns null

      It should return an instance of the object right ? There is nothing different about the embedded version ?

      ps. I HAVE to do a lookup, I cannot use @EJB for this.

      Thanks

      Daniel

        • 1. Re: Problem with Embeddable EJB3
          bill.burke

          yes, you are missing something, but not your fault...


          EJBContext.lookup looks in the ENC of the EJB it is not a global JNDI lookup.

          Have you bound the EJB within an ejb-ref? If not then you need to do a straight JNDI lookup of your EJB ref:


          new InitialContext().lookup("BeanName/local");

          • 2. Re: Problem with Embeddable EJB3
            mrhightech

            Good! Indeed, using a new InitialContext() solves the problem.

            This is apparently not the case in JBoss versus the embedded version. How is it different?

            Thanks Bill.

            Daniel