| Author |
EJB call with websphere 6
|
Thomas Fourest
Greenhorn
Joined: Mar 27, 2006
Posts: 5
|
|
I try to call an .ear on my websphere 6. it 's deployed with the following properties: Module | EJB | EJB URI | Nom JNDI ------------------------------------------------------------------- T9AS | CallServer | t9as-fw.jar,META-INF/ejb-jar.xml | T9AS and I have the following problem: java.lang.ClassCastException: Unable to load class: com.itnsa.fw.server.interfaces._CallServerHome_Stub at com.ibm.rmi.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:366) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:157) at TestAppelEjb.<init>(TestAppelEjb.java:153) at TestAppelEjb.main(TestAppelEjb.java:30) (I don't understand why I have a stub problem with the EJB abstraction: why the ibm can do that to me ;-) other information: -I use JDK 1.5 -I have configured a "JDBC provider" on my websphere and it's working (the websphere 's console 's test is good) my client code: String URLParam = "iiop://localhost:2809"; String contextParam = "com.ibm.websphere.naming.WsnInitialContextFactory"; String securityParam = "TFT"; String credentialParam = "Tttttt2"; String appelParam = "T9AS"; //"CallServer"; Properties env = new Properties(); env.setProperty(Context.PROVIDER_URL, URLParam); env.setProperty(Context.INITIAL_CONTEXT_FACTORY,contextParam); env.setProperty("java.naming.security.principal",securityParam); env.setProperty("java.naming.security.credentials", credentialParam); try { InitialContext ctx = new InitialContext(env); Object home = ctx.lookup(appelParam); /******* my great problem **********/ Object o = PortableRemoteObject.narrow(home, CallServerHome.class); CallServerHome clientHome = (CallServerHome) o; CallServer client = (CallServer) PortableRemoteObject.narrow(clientHome.create(),CallServer.class); /***** my dream *******/ client.executeExterne(); } catch(NamingException ne) { System.err.println("Essai failed to lookup"); ne.printStackTrace(System.err); } } catch (Exception e) { e.printStackTrace(); } thanks for your help, Thomas
|
 |
Thomas Fourest
Greenhorn
Joined: Mar 27, 2006
Posts: 5
|
|
sorry I was mistaken in the first post: I USED IBM JRE PROVIDE BY WEBSPHERE my client import : import java.util.*; import java.sql.*; import javax.naming.*; import javax.rmi.*; import java.lang.reflect.*; import javax.ejb.CreateException; import com.*****.fw.iop.*; import com.*****.fw.server.interfaces.CallServer; import com.*****.fw.server.interfaces.CallServerHome; import com.*****.fw.services.CallServerBean;
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
|
It looks as if the stub class (generated by Websphere) of CallServerHome is not on the client's classpath.
|
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
|
 |
Thomas Fourest
Greenhorn
Joined: Mar 27, 2006
Posts: 5
|
|
Thanks for your help Roger . " import com.itnsa.fw.server.interfaces.*; " unfortunately it doesn't solve the problem. I don't understand a fundamental process: when we work with the RMI IIOP protocol (in the last versions of java's standard) , we have to create just a Stub for the client with the rmic command (is it true?). I have written a little application in RMI this weekend and I had just to add a stub on the client side (if I have a good memory) and I succed. But the problem with the EJB (I deploy an .ear on my websphere) is the following: I build an .ear and I deploy it on my websphere. I build a .jar for my client (for the dependencies). this process don't allowed me to put an stub anywhere. to solve my pb I create stub from my class in my eclipse workspace " set ROOT_DIR=. set JAVA_HOME=C:\Program Files\IBM\WebSphere\AppServer\java\jre set CLASSPOT = .; %ROOT_DIR%\Coplib\activation.jar; %ROOT_DIR%\Coplib\bsf.jar; %ROOT_DIR%\Coplib\bsh-2.0b2.jar; %ROOT_DIR%\Coplib\Common.jar; %ROOT_DIR%\Coplib\commons-collections-3.0.jar; %ROOT_DIR%\Coplib\commons-dbcp-1.2.1.jar; %ROOT_DIR%\Coplib\commons-io-1.0.jar; %ROOT_DIR%\Coplib\commons-lang-2.0.jar; %ROOT_DIR%\Coplib\commons-mail.jar; %ROOT_DIR%\Coplib\commons-pool-1.2.jar; %ROOT_DIR%\Coplib\db2fs.jar; %ROOT_DIR%\Coplib\db2java.jar; %ROOT_DIR%\Coplib\db2jcc.jar; %ROOT_DIR%\Coplib\db2jcc_javax.jar; %ROOT_DIR%\Coplib\db2jcc_license_cisuz.jar; %ROOT_DIR%\Coplib\db2jcc_license_cu.jar; %ROOT_DIR%\Coplib\db2policy.jar; %ROOT_DIR%\Coplib\groovy-all-1.0-jsr-03.jar; %ROOT_DIR%\Coplib\iText.jar; %ROOT_DIR%\Coplib\jakarta-oro-2.0.8.jar; %ROOT_DIR%\Coplib\jboss-j2ee.jar; %ROOT_DIR%\Coplib\jdom.jar; %ROOT_DIR%\Coplib\jt400.jar; %ROOT_DIR%\Coplib\jtds-1.1.jar; %ROOT_DIR%\Coplib\mail.jar; %ROOT_DIR%\Coplib\mysql-connector-java-3.0.15-ga-bin.jar; %ROOT_DIR%\Coplib\objectprofiler.jar; %ROOT_DIR%\Coplib\ojdbc14.jar; %ROOT_DIR%\Coplib\ooffice.jar; %ROOT_DIR%\Coplib\QuickServer.jar; %ROOT_DIR%\Coplib\xerces.jar; rmic -iiop -classpath %CLASSPOT% com.itnsa.fw.server.interfaces.CallServerHome " (I works good) I build my .jar and I put the "_CallServerHome_Stub.class" in the path referenced by the ERROR with Winrar (near the "CallServerHome") It doesn't solve my problem. The ejb client want the stub It is incredible: I had deployed (in januar) my .ear in Oracle Application Server and after a little work , it was good.... What can i do? Thanks for your help .
|
 |
Thomas Fourest
Greenhorn
Joined: Mar 27, 2006
Posts: 5
|
|
My boss solve the problem : when you deploy your .ear in websphere , it modifies the .jar included in the .ear with the stub class. The pb is the following: My client point on my locally .jar I have modify the solution is to point on the .jar on websphere I 'll try this solution By, Thomas
|
 |
Thomas Fourest
Greenhorn
Joined: Mar 27, 2006
Posts: 5
|
|
It 's working thanks for your help. Thomas
|
 |
Paul Michael
Ranch Hand
Joined: Jul 02, 2001
Posts: 697
|
|
Originally posted by Thomas Fourest: when you deploy your .ear in websphere , it modifies the .jar included in the .ear with the stub class. By, Thomas
Thanks for the hint. I'm a newbie in Websphere and I'm beginning to wonder how I would be able to generate the client jar for stubs. This post saved me a lot of time. Thanks.
|
SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
|
 |
 |
|
|
subject: EJB call with websphere 6
|
|
|