JBoss Community

Re: @EJB(lookup) fails while context.lookup() is successfull

created by Jason Greene in JBoss AS7 Development - View the full discussion

Dan Sirbu wrote:

 

Example is defined as : public class Example extends HttpServlet - so it should be an EE component.



 

Then within the class definition I have:

 

    @EJB
    private ILcExample lc;

 

Within Example.java the @EJB injection works ok no need to specify lookup or mappedName ....

 

If I move that within another class that is part of the same package as Example.java the injection fails. I tried with lookup or mappedName and no success.

 

Is this other class an EE component (it is a servlet, managed bean, etc)?

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community