This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Calling EJB3.0 from EJB2.0 on a WAS7 cluster Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Calling EJB3.0 from EJB2.0 on a WAS7 cluster" Watch "Calling EJB3.0 from EJB2.0 on a WAS7 cluster" New topic
Author

Calling EJB3.0 from EJB2.0 on a WAS7 cluster

Michael M. Wilson
Greenhorn

Joined: Jul 18, 2011
Posts: 1
Hey Folks,

Hoping you can help - I'm totally stuck.

I have been trying to call an EJB3 on a WAS7 cluster from RAD6 (WAS5).

Calling the EJB from RAD7.5 works fine. The issue lies in obtaning the initial context for the WAS7 cluster from the RAD6 (WAS5) development environment.

Here is a sample of the code I'm using.

try{

Properties properties = new Properties();

properties.put(Context.INITIAL_CONTEXT_FACTORY , "com.ibm.websphere.naming.WsnInitialContextFactory" );
properties.put(Context.PROVIDER_URL , "corbaloc::server1:9811/NameServiceServerRoot");

Context context = new InitialContext(properties);

Object result = context.lookup(MyBean.class.getName()) ;
MyBean myBean = (MyBean)PortableRemoteObject.narrow(result, MyBean.class) ;
System.out.println(myBean.myMethod("test"));

}catch(Exception ex){
ex.printStackTrace() ;

}


Here is the stacktrace:

[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context with the provider URL: "corbaloc::server1:9811/NameServiceServerRoot". Make sure that any bootstrap address information in the URL is correct and that the target name server is running. A bootstrap address with no port specification defaults to port 2809. Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration. Root exception is org.omg.CORBA.INTERNAL: Unable to create ClientSubcontract for scid:18 vmcid: IBM minor code: 59D completed: No
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.SubcontractRegistry.getClientSubcontract(SubcontractRegistry.java(Compiled Code))
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.iiop.CDRInputStream.newObjRef(CDRInputStream.java:1115)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:1078)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:1013)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.corba.IorURL.iorbytesToObjref(IorURL.java:106)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.corba.IorURL.resolve(IorURL.java:94)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.corba.ORB.objectURLToObject(ORB.java:3436)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.CORBA.iiop.ORB.objectURLToObject(ORB.java:3374)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:3325)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1256)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtxFactory.getCosRootContext(WsnInitCtxFactory.java:774)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:689)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:607)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java(Compiled Code))
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java(Compiled Code))
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java(Inlined Compiled Code))
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java(Compiled Code))
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at javax.naming.InitialContext.lookup(InitialContext.java(Compiled Code))
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.local.testwebclient.ClientServlet.performTask(ClientServlet.java:114)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.local.testwebclient.ClientServlet.doGet(ClientServlet.java:35)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1019)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
[7/18/11 16:32:32:973 EDT] 6af57da7 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I believe, EJB2 and EJB3 are completely different specifications and may not be compatible with each other.


S.D. MADHAN
Not many get the right opportunity !
Askar Akhmerov
Greenhorn

Joined: Apr 13, 2010
Posts: 20

My first suggestion is that you have different classes version on your RAD from v6.
So, try to replace .jar files that are used by RAD to lookup stuff from contexts.

If that doesn't help you out, try using SOAP API instead of RMI which you are trying to use at the moment.

Regards, Askar.
Gabriel Vince
Greenhorn

Joined: Feb 05, 2009
Posts: 24
Hello,
try to search on the developerWork site, I have a feeling that the big blue has published a way to work. The trick was that even for ejb3 you can specify a home interface (with @Home). Ejb2 context expects the home interface under the lookup jndi.
Unfortunately I have only an older version here, so I cannot test it by myself.
Good luck.
G.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling EJB3.0 from EJB2.0 on a WAS7 cluster
 
Similar Threads
login error using WSAD5.1 & Oracle
WAS7 cluster member: can't lookup from WSAD 5.1.2
remote EJB server's
Test Connection failed ( IBM Websphere 5.1 Express )
auto commit within JTS transaction