users@glassfish.java.net

jndi lookup of local session bean

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 Jul 2008 10:39:29 PDT

Hi.

I am trying to lookup a session bean that implements a local interface. I am doing this inside an entity bean using the initial context.

ic = new InitialContext();
MarketMakerLocal foo = (MarketMakerLocal) ic.lookup("java:comp/env/MarketMaker");

GlassFish cannot find the bean but it is deployed and working fine. My question is: how can I find the jndi name of my session beans? I've tried everything but it doesn't work. I also tried to make a factory pojo that is called from within a session bean to lookup the MarketMaker bean, but it doesn't work.
The reason why I am not using the @EJB annotation to inject the session bean is that I am loading the bean dynamically depending on some entity beans property.

It's impossible to find the jndi name, or do I need a remote interface to do this??
Please help.
[Message sent by forum member 'youngzaphod' (youngzaphod)]

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