geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lucky lance <luckylance2...@yahoo.ca>
Subject Re: How to lookup an EJB3 session bean by JNDI?
Date Fri, 08 Feb 2008 21:03:52 GMT
Thank you for a quick response. 
I am a new learner of Geronimo. 
Actually my client code is,
Hashtable<String,String> env = new Hashtable<String,String>();         env.put("java.naming.factory.initial","org.apache.openejb.client.RemoteInitialContextFactory");
env.put("java.naming.provider.url","iiop://localhost:1050");
InitialContext ctx = new InitialContext(env);

Object obj = ctx.lookup(jndiName);

The problem is no matter how I write the jndiName, a NamingException will be thrown complaining
it can not find the name. And the similiar code works fine in Glassfish, JBoss, WebSphere
6.1 + EJB3, and .
My question is whether geronimo supports  the standard way ctx.lookup("foo.MyBean") as well,
or what's the proper jndi string?

My result of jndi names,
Glassfish:  "foo.MyRemote"
JBoss:      "foo.MyBean/remote"
Webshpere: "foo.MyRemote" with IBM  jvm.
  "nodes/<hostname>/node/servers/server1/foo\.MyRemote" with Sun jvm.
Geronimo:   ?

Or is where any setting to enable the remote EJB client
from the default.

Thanks
Lance

Viet Nguyen <vhnguy2@gmail.com> wrote: 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://" +
+ ":" + 
);
                Context ic = new InitialContext(props);
                myBean = (MyBeanRemote) ic.lookup();

where  can be found in your geronimo-log and  is
whatever your server's IP is.

Hope this helps,
Viet Nguyen




       
---------------------------------
Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new
Yahoo! Mail  
Mime
View raw message