Meaningless Drivel is fun!*
The moose likes Websphere and the fly likes EJB Call to different server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "EJB Call to different server" Watch "EJB Call to different server" New topic
Author

EJB Call to different server

Andreas Kuhn
Greenhorn

Joined: Feb 10, 2003
Posts: 4
Hi,
i have a problem calling an EJB from within Websphere AppServer (inside an EJB) running on a different Instance (also different AdminServer)
When creating the JNDI Context a specify the provider url of the remote server, but it seems the lookup still occurs on the local server and the EJB is not found.
Is there something else i have to specify, so that the remote server will be used ?
Regards,
Andi
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
No, you should have
iiop://server-name and port
for example:
iiop://localhost:900
When you want to change the server that it's on, simply change the server-name. Also, make sure the jndi lookup name is the same.
[ February 10, 2003: Message edited by: William Duncan ]
[ February 10, 2003: Message edited by: William Duncan ]
[ February 10, 2003: Message edited by: William Duncan ]

No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
Andreas Kuhn
Greenhorn

Joined: Feb 10, 2003
Posts: 4
Hi William,
unfortunately it doesn't work
I have to Websphere 4.0.4 instances (2 AdminServer with each having one AppServer instance).
I deploy EJB A on first and EJB B on second server. Using wscp i see with C init/list that the EJB are bind in the JNDI ( EJB A on server A and EJB B on server B).
Now i try to call EJB B from EJB A, using Provider URL with the Port of server B, but it cannot find the reference in the JNDI
I always get:
[2/11/03 14:36:12:536 CET] 14a306 Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ejs.ns.jndi.CNContextImpl
Context method: list
Context name: domainRoots/UnspecifiedDomainName/legacyRoot
Target name: ejb
Other data:
Exception stack trace: javax.naming.PartialResultException: org.omg.CORBA.OBJECT_NOT_EXIST: minor code: 0 completed: No. Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: minor code: 0 completed: No
at com.ibm.CORBA.iiop.ExtendedServerDelegate.getServant(ExtendedServerDelegate.java:121)
at com.ibm.rmi.iiop.CDRInputStream.newObjRef(CDRInputStream.java:921)
at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:881)
at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:823)
at org.omg.CORBA.ObjectHelper.read(ObjectHelper.java:50)
at com.ibm.WsnOptimizedNaming.BindingDataHelper.read(BindingDataHelper.java:117)
at com.ibm.WsnOptimizedNaming.BindingDataListHelper.read(BindingDataListHelper.java:51)
at com.ibm.WsnOptimizedNaming._NamingContextStub.list_complete_info(_NamingContextStub.java:295)
at com.ibm.ejs.ns.jndi.CNNameEnumeration.initOpt(CNNameEnumeration.java:143)
at com.ibm.ejs.ns.jndi.CNNameEnumeration.doInit(CNNameEnumeration.java:96)
at com.ibm.ws.naming.util.WsnNamingEnumeration.init(WsnNamingEnumeration.java:125)
at com.ibm.ejs.ns.jndi.CNNameEnumeration.<init>(CNNameEnumeration.java:77)
at com.ibm.ejs.ns.jndi.CNContextImpl.doList(CNContextImpl.java:2272)
at com.ibm.ejs.ns.jndi.CNContextImpl.list(CNContextImpl.java:982)
at com.ibm.ws.naming.util.WsnInitCtx.list(WsnInitCtx.java:268)
at javax.naming.InitialContext.list(InitialContext.java:385)
at com.mlp.bpi.common.plugin.AccessCheckPlugin.execute(AccessCheckPlugin.java:92)
at com.syngenio.fwimpl.common.plugin.PluginHandler.callPlugins(PluginHandler.java:84)
at com.syngenio.fwimpl.common.plugin.PluginHandler.callPlugins(PluginHandler.java:69)
at com.syngenio.fwimpl.application.MessageDispatcher.internalDispatch(MessageDispatcher.java;com/syngenio/fwimpl/common/util/perf/PerformanceAspect.java(1k):158)
at com.syngenio.fwimpl.application.MessageDispatcher.dispatch(MessageDispatcher.java;com/syngenio/fwimpl/common/util/perf/PerformanceAspect.java(1k):110)
at com.syngenio.fwimpl.application.ClientDispatcherBean.process(ClientDispatcherBean.java:64)
at com.syngenio.fwimpl.application.EJSRemoteStatefulClientDispatcher.process(EJSRemoteStatefulClientDispatcher.java:25)
at com.syngenio.fwimpl.application._EJSRemoteStatefulClientDispatcher_Tie._invoke(_EJSRemoteStatefulClientDispatcher_Tie.java:122)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:515)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2377)
at com.ibm.CORBA.iiop.OrbWorker.run(OrbWorker.java:186)
at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run(ThreadPool.java:104)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:137)

Any ideas ??
Thanks,
Andi
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
Could you post the code where EJB A calls EJB B?
Andreas Kuhn
Greenhorn

Joined: Feb 10, 2003
Posts: 4
9037 Is BootStrapPort of Server B (same machine).

String url = "iiop://10.162.166.144:9037";
Properties env = new Properties();
env.put( Context.PROVIDER_URL, url );
env.put( Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");

Context clInitContext = new InitialContext(env);
Hashtable ht1 = clInitContext.getEnvironment();
System.out.println( "new: " + ht1 );
NamingEnumeration nenu = clInitContext.list("ejb");
while( nenu.hasMoreElements() )
System.out.println( nenu.nextElement() );
Object objref = clInitContext.lookup("ejb/auth/AuthService");

Using it from within a standalone Java program works fine, but not from within an EJB
Andi

Originally posted by William Duncan:
Could you post the code where EJB A calls EJB B?
Andreas Kuhn
Greenhorn

Joined: Feb 10, 2003
Posts: 4
Hi again,
i just tried to call the EJB on a server on a different machine -> works without any problem.
So it seems that the problem occurs only when calling an EJB on a server on the same machine. Probably the multiple instance installation has some problems but i have no idea what exactly.
Regards,
Andi
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
Perhaps they are using the same ejb container or the containers are sharing one or all virtual machines (as I understand it, most EJB containers use multiple VMs). Probably a question for Kyle. Wish I could have been of more help.
Patrick Finnegan
Ranch Hand

Joined: Mar 05, 2002
Posts: 179
Try running two appservers(JVMs) under the same WebSphere instance. I assume that the production environment will not have dual instances of WebSphere.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB Call to different server
 
Similar Threads
Local EJB calls between separate ear/jar possible ?
how to access this remote EJB server
@EJB annotation from a remote client
JNDI naming and DI in EJB 3
Security Context Propagation