I'm assuming that you want to remotely look up the session bean.
If it is so you can use this piece of code:
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "ejbd://" +
<ip>+ ":" + <port>);
Context ic = new InitialContext(props);
myBean = (MyBeanRemote) ic.lookup(<jndi-name>);
where <jndi-name> can be found in your geronimo-log and <ip> is
whatever your server's IP is.
Hope this helps,
Viet Nguyen
On Feb 8, 2008 2:32 PM, lucky lance <[EMAIL PROTECTED]> wrote:
> Hi all,
> I deployed an EJB3 stateless session bean in geronimo 2.0.2.
> Then I try to lookup it via the traditional JNDI.
> The code
> package foo;
> @Remote
> public interface MyRemote{
> public String getMessage();
> }
>
> package foo;
> @Stateless
> public class MyBean implements MyRemote{
> public String getMessage(){
> return "hello world";
> }
> }
>
> // The client
> InitialContext ctx = new IntialContext();
> Object obj = ctx.lookup("foo.MyBean");
>
> It throws a NamingException.
> I can not lookup either by the names like,
> "MyBean",
> "foo/MyBean",
> "java:comp/foo.MyBean",
> "java:comp/env/foo.MyBean",
> "java:comp/foo/MyBean",
> "EJBModule/foo/MyBean/1.0/jar/SessionBeans/MyBean",
> "EJBModule/foo/MyBean/1.0/jar/SessionBeans/foo.MyBean",
> "EJBModule/foo/MyBean/1.0/jar/SessionBeans/foo/MyBean",
>
>
> The question is how to write the correct jndi name?
> Thanks
>
>
>
> ________________________________
> Be smarter than spam. See how smart SpamGuard is at giving junk email the
> boot with the All-new Yahoo! Mail