users@glassfish.java.net

Can't lookup a remote EJB2 from a EJB3

From: <forums_at_java.net>
Date: Tue, 18 Sep 2012 08:12:54 -0500 (CDT)

Hi, I have a problem to lookup programmatically a remote EJB which is
deployed on a GlassFish v2. My Application is a JEE6 App running on GlassFish
v3. I can lookup the remote ejb without any problem when I use the
glassfish-ejb.jar xml. I use an entry like: MyESI ejb/MY_EJB_SERVICE_LOCAL
corbaname:iiop:ltest.net:3791#com.foo.BusinessServicesRemote But I can not
use the 'hard-coded' glassfish-ejb-jar.xml file because I need to lookup the
same bean from different remote servers. For that reason I use a code like
this to lookup the ejb programmatically : props = new Properties();
props.setProperty("org.omg.CORBA.ORBInitialHost", "ltest.net");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3791"); ic = new
InitialContext(props); String
sJNDI="java:global/com.bmw.ucp.bus.facade.BusinessServicesRemote"; service =
(BusinessServicesRemote) ic.lookup(sJNDI); But this did not work. I got a
error: java.lang.ClassCastException: Object is not of remote type
com.sun.enterprise.naming.impl.SerialContextProvider Has anyone an idea why
this did not work? It seems to be something with the
SerialInitContextFactory. If anyone have an example how to lookup a ejb2 from
a ejb3 remotely this would be helpful. regards Ralph

--
[Message sent by forum member 'rsoika']
View Post: http://forums.java.net/node/890331