Use EJB3 from simple class


EJB programming & troubleshooting: Use EJB3 from simple class

  1. Use EJB3 from simple class (1 messages)

    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?
  2. Got the answer! :) EJB objects in POJO classes can only be acquired using InitialContext (At least in Glassfish, which I use). Excellent resource: