GeeCON Prague 2014*
The moose likes Websphere and the fly likes Running a Java client that connects to EJBs deployed on WAS 7 without stubs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "Running a Java client that connects to EJBs deployed on WAS 7 without stubs" Watch "Running a Java client that connects to EJBs deployed on WAS 7 without stubs" New topic
Author

Running a Java client that connects to EJBs deployed on WAS 7 without stubs

Mohamed Soliman
Greenhorn

Joined: Mar 09, 2010
Posts: 13
I've a problem in connecting to EJBs (EJB 2.0) deployed on WAS 7.0. I'm connecting through a desktop client by using the jars located in %was_home%\runtimes but when I look up on the EJB deployed on the server I get the following exception:

java.lang.ClassCastException: Unable to load class: com.asset.jupiter.rm.ejb._RM
EJBHome_Stub
at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObjec
t.java:372)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)

after research I've found that the client looks for EJB stub classes but they are not found on the client jars so the exception is thrown. I've tried copying the jars containing the EJBs and their generated stubs from WAS deployment directory to my client directory and the application launched successfully. My question is, is there a way to connect to the EJBs from the local client WITHOUT having these stub classes in my client jars?

waiting for your support..many thanks
Marcelo Sousa Ancelmo
Ranch Hand

Joined: Jan 17, 2002
Posts: 497

Hello Mohamed,

Did you tried to generate the ejb client jar (containing only the local / remote interface) and then used that jar in your application classpath?

Regards,


Marcelo Sousa Ancelmo - Brazil
Mohamed Soliman
Greenhorn

Joined: Mar 09, 2010
Posts: 13
Hello Marcelo

This is the exact scenario I'm having

1. I deployed the EAR file of my application which contains the jar file of the EJBs (the jar file is generated by jdeveloper 10.0.0.1 without stubs)

2. I deploy the EAR file using Websphere deployment console and in the deployment directory, I found that webpshere injects the stub classes into the jar file of the ejbs (this jar WORKS when copied to the client application's classpath)

3. On the client classpath, I've the version of the jar BUT without stubs (this throws the exception)

4. I need to run the client with the version without the stubs (because I dont want to copy the deployed websphere jar to each client)

also I've a question, I've read that the j2ee EJB specification requires the stubs to be available in BOTH the client and the server as well, does JBOSS and OC4J (my application works on these containers WITHOUT the stubs being on either the client or the server!)

thanks alot for your reply!
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3112
    
  42

Marcelo, please check your private messages regarding an important administrative matter


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
 
GeeCON Prague 2014
 
subject: Running a Java client that connects to EJBs deployed on WAS 7 without stubs