Hello, I'm trying to use a stateless bean from a simple class. When I use following in a servlet class (descending from HttpServlet), @EJB public GatewaySessionLocal bean; bean variable is filled in and everything's cool. But when I do the same in a class, descending directly from Object, bean variable stays null. Are there any specific conditions to be met by a class which tries to access bean in such a way?
- Posted by: Alucard Hellsing
- Posted on: July 26 2008 17:34 EDT
Got the answer! :) EJB objects in POJO classes can only be acquired using InitialContext (At least in Glassfish, which I use). Excellent resource: https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB