users@glassfish.java.net

Looking up a stateless session bean from a POJO in the Web tier

From: <glassfish_at_javadesktop.org>
Date: Fri, 09 May 2008 01:14:06 PDT

Hi,

How can I lookup an EJB3 stateless session bean in the Web tier inside a POJO class without using injection?

The following code fails:

UserManager userManager = (UserManager) ctx.lookup("java:comp/env/BeanName");

where BeanName is the name assigned to the session bean via the @Stateless annotation.

Also this doesn't work:

UserManager userManager = (UserManager) ctx.lookup(UserManager.class.getName());

Thanks in advance,
Behrang
[Message sent by forum member 'behrangsa' (behrangsa)]

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