This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Misterious Problem invoking remote EJB3 on WAS 7 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 » Java » EJB and other Java EE Technologies
Bookmark "Misterious Problem invoking remote EJB3 on WAS 7" Watch "Misterious Problem invoking remote EJB3 on WAS 7" New topic
Author

Misterious Problem invoking remote EJB3 on WAS 7

ismael cabanas
Greenhorn

Joined: Jan 03, 2012
Posts: 5
Hi, i apology about my english.

I am trying with EJB 3 technology. I have two ears applications, one of them is a web application and the other one is an application with remote EJBs, using EJB 3.0. I deploy them in the same server, Websphere 7, and they start succesfully. My test is invoking EJBs through @EJB annotation and through "lookup", then, the web application has a Servlet with a reference at EJB through @EJB annotation, and other reference at remote interface, i.e.



I have the following problem: When i start the applications all works fine, i get the EJB annoted and through jndi lookup, but when i restart or republish the ear containing web application, i get the EJB annonted and it works fine, but when i try to get the EJB through JNDI lookup i get the following error:

"org.icabanas.pruebaconcepto.facade._ProductoSessionFacade_Stub incompatible with org.icabanas.pruebaconcepto.facade.ProductoSessionFacade"

Any idea about what happen?

Thanks in advanced!
massimiliano cattaneo
Greenhorn

Joined: Jun 30, 2011
Posts: 24

If I correctly undertood the EJB is in a ear different from the JSP so You should Try this

java:global[/<app-name>]/<modulename>/<bean-name>[!<fullyqualified-interface-name>]

where app_name is the ear name, modulename is the EJB-JAR name, bean-name is the name of the bean, fully qualified name is the fully qualified name of your bean/interface. In this case the remote interface

for example
java:global/testEAR/testEJB/beanName!com.test.SessionRemote

I hope this can help


[SCJP 6.0 88%] [OCPJBCD 6.0 96%] [OCPJWCD 6.0 87%]
ismael cabanas
Greenhorn

Joined: Jan 03, 2012
Posts: 5
Hi Massimiliano, you understand me perfectly.

I tried lookup with "java:global/prueba-concepto-ejbs-ear/prueba-concepto-ejbs/ProductoSessionFacadeEjb!org.icabanas.pruebaconcepto.facade.ProductoSessionFacade"

but i get the following exception:

[4/01/12 12:56:51:961 CET] 0000001b SystemErr R javax.naming.NameNotFoundException: Name global not found in context "java:".
ismael cabanas
Greenhorn

Joined: Jan 03, 2012
Posts: 5
I continue with my problem....

With the following jndi name "ejb/prueba-concepto-ejbs-ear/prueba-concepto-ejbs.jar/ProductoSessionFacadeEjb#org.icabanas.pruebaconcepto.facade.ProductoSessionFacade" i get the EJB, but if i restart the EAR containing the web application (the client application of the EJBs, they are in other EAR deploy on the same server), when i try get the EJB by lookup, i get the following exception

[4/01/12 13:22:05:616 CET] 0000001b SystemErr R java.lang.ClassCastException: org.icabanas.pruebaconcepto.facade._ProductoSessionFacade_Stub incompatible with org.icabanas.pruebaconcepto.facade.ProductoSessionFacade
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at org.icabanas.pruebaconcepto.web.servlet.ProductoServlet.doPost(ProductoServlet.java:55)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1657)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:939)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:445)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:504)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:301)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:275)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[4/01/12 13:22:05:616 CET] 0000001b SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
massimiliano cattaneo
Greenhorn

Joined: Jun 30, 2011
Posts: 24

Hello,
Sorry WAS 7 is J2EE 5 compiant not 6 this is why global doesn't work.

ismael cabanas
Greenhorn

Joined: Jan 03, 2012
Posts: 5
Please, i need some help. I am going to expose my problem in other way:

Hi, i have two ears deployed in the same server, Websphere 7. One EAR contain my EJBs3 and the other EAR contain a web application, and i want to try to call remote EJBs through annontation and JNDI lookup.

In the web application EAR, i have the following Servlet:



And, in the EAR containing EJBs i have the following Session Stateless bean and his remote interface:



Ok, if i deploy the two ears in the server and execute the servlet, it works well, i get the EJBs by the two ways (annontation and JNDI lookup), and i get the expected trace (a simple text in the console):



But now, if i restart the EAR containing de web application, it doesn't work fine, i get the EJB annotated but i can't get the EJB through JNDI lookup and get the following trace:



What's wrong?, any idea?

Thanks in advanced!
Dmitry Klochkov
Greenhorn

Joined: Jun 21, 2012
Posts: 1
Hello, Ismael. I am now experiencing similar problem. I periodically get ClassCastException while doing remote lookup between two different EAR's on the same jvm. Have you found a solution?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Misterious Problem invoking remote EJB3 on WAS 7
 
Similar Threads
EJB Accessibility
J2EE Recommended Reading
Ways to get hold of RemoteInterface
IBM 483 (ICE Test)
portlet accessing ejb