users@glassfish.java.net

SessionBean Lookup/Injection from a pojo within the same EAR

From: <glassfish_at_javadesktop.org>
Date: Tue, 16 Sep 2008 21:33:22 PDT

I have been scratching my head over this for some time now and I figured it was time to post. I've been searching left and right and have found no answers to my specific problem. So... here it goes.

I have a project setup using Maven with 3 sub projects. The projects are as follows, web, ejb, ear, and the main pom. With this said I have session facades setup which call my entity beans. I am able to use the session beans perfectly fine through injection on the web side inside of the ManagedBeans. My problem is a POJO class on the EJB side that needs to use a SessionBean. I have been trying everything in the glassfish EJB FAQ with no luck. Below are the examples

Session Bean

[code]
@Stateless(name="ejb/MessageManagerBean")
public class MessageManagerBean implements MessageManagerLocal
[/code]

POJO using JNDI
[code]
 context = new InitialContext();
            messageManager = (MessageManagerLocal)context.lookup("java:comp/env/ejb/MessageManagerBean");
[/code]

Obviously I just don't get it. Can somebody enlighten me as to what I'm doing wrong.
[Message sent by forum member 'sloanb' (sloanb)]

http://forums.java.net/jive/thread.jspa?messageID=299732