users@glassfish.java.net

Lookup fails for Local Stateless Bean from web client in Glassfish V2.2

From: <glassfish_at_javadesktop.org>
Date: Sat, 25 Sep 2010 08:25:09 PDT

I've been having troubles looking up a Stateless Bean from a web client defined in another war file.

I defined the bean using a class like this:
@Stateless
public class MyStatelessBean implements MyStatelessBeanLocal {
   
}

and an interface like this:
@Local
public interface MyStatelessBeanLocal {
    
}

I looked up the bean from the web client using this approach:
Context c = new InitialContext();
return (MyStatelessBeanLocal) c.lookup("java:comp/env/MyStatelessBean");

but it claims that there is no object bound to that name.

(I also tried the @EJB MyStatelessBeanLocal reference using injection, but got the same result.)

Oddly enough another Stateless bean worked fine for me using the same approach so there is some small thing wrong that I'm not seeing. I tried calling it from a web service and that worked fine so I think the service is deployed correctly, but perhaps the context is getting mucked up from the other war file?

I tried navigating the JNDI graph via the Glassfish admin web client and programatically, but I didn't see any of the "Local" EJB services in the graph.

How can I find out where the bean is being stored in the JNDI graph or should I be using another JNDI name? (I read something about using the global mapped name rather than the default name, but wondered why one bean would be found and another not.)

Thanks,

Rob
[Message sent by forum member 'rrr6399']

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