Hi Christian,
Try this:
@Stateless
public class OrangeBean implements OrangeLocal
{
public String echo(String s)
{
return s;
}
}
@EJB(name="orange", beanInterface = OrangeLocal.class)
@Stateless
public class TestBean implements TestLocal
{
@Resource
private SessionContext sessionContext;
public void test()
{
OrangeLocal orangeLocal = (OrangeLocal)
sessionContext.lookup("orange");
}
}
The @EJB annotation declares a reference to the Orange bean. The
sessionContext.lookup is a convenience method around 'new
InitialContext().lookup("java:comp/env/"+name)' and by default the
'java:comp/env' namespace is empty unless references are declared via
annotation or xml.
-David
On May 1, 2009, at 2:28 PM, Christian Bourque wrote:
Hi,
What JNDI path should I use to lookup an EJB using a SessionContext
which has been injected:
@Stateless
public class TestBean implements TestLocal
{
@Resource
private SessionContext sessionContext;
public void test()
{
sessionContext.lookup("???");
}
}
I've tried different combinations without any success...
Thanks
Christian