aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB in WebSphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB in WebSphere" Watch "EJB in WebSphere" New topic
Author

EJB in WebSphere

Christine Li
Greenhorn

Joined: Sep 25, 2001
Posts: 9
Hi, Please help
I deployed my CMP EJB in WebSphere3.5. I do not have problem to run servlet program which is also deployed in WebSphere3.5. but when i run my simple java class from JDK, my javaclass can not find the EJB home interface. I am getting NoClassDefError:
com.ibm.rmi.iiop.ORB
In my classpath setting, i put EJB client jar (exported from VisualAge for Java 3.5), UJC.jar from WebSphere/Appserver/lib (it includes CORBA.IIOP package). Could some one tell me what else I need add to the classpath?
or let me redress my question, could some one tell me which jar file of WAS3.5 contain com.ibm.rmi.iiop.ORB? or where can i find the file structure for WAS3.5?
Thank you very much for any kinds of suggestion.
Regards,
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
You will also need to add ejs.jar to your classpath. Also, be certain that you are using IBM's JRE (the one that ships with WebSphere). Here's a sample batch file that I use for client programs in WebSphere 3.5 (taken from my book).
rem setup the classpath
SET WAS_HOME=I:\WebSphere\AppServer
SET JAVA_HOME=I:\WebSphere\AppServer\JDK\Jre
set WAS_CP=%WAS_CP%;%WAS_HOME%\lib\ejs.jar
set WAS_CP=%WAS_CP%;%WAS_HOME%\lib\ujc.jar
set WAS_CP=%WAS_CP%;%JAVA_HOME%\lib\classes.zip;
set WAS_CP=%WAS_CP%;hellowebsphereclient.jar;
rem start the client program
%JAVA_HOME%\bin\java -classpath %WAS_CP%;. com.ibm.ws.book.example.clients.HelloWebSphereEJBClient

------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Christine Li
Greenhorn

Joined: Sep 25, 2001
Posts: 9
Hi, Kyle
Thank you very much for your reply. I tried according your suggestion. I am still getting the following error, could you tell me how to solve this problem? I do appreciate your help.
javax.naming.ServiceUnavailableException. Root exception is java.lang.NullPoint
erException
at com.ibm.CORBA.iiop.IOR.read(Unknown Source)
at com.ibm.CORBA.iiop.ClientResponseImpl.read_Object(Unknown Source)
at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:728)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve(Unknown Source)
at com.ibm.CORBA.iiop.InitialNamingClient.cachedInitialReferences(Unknow
n Source)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve_initial_references(Unk
nown Source)
at com.ibm.CORBA.iiop.ORB.resolve_initial_references(Unknown Source)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initRootContext(CNInitial
ContextFactory.java:504)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNIniti
alContextFactory.java:274)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
71)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
)
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)

Originally posted by Kyle Brown:
You will also need to add ejs.jar to your classpath. Also, be certain that you are using IBM's JRE (the one that ships with WebSphere). Here's a sample batch file that I use for client programs in WebSphere 3.5 (taken from my book).
rem setup the classpath
SET WAS_HOME=I:\WebSphere\AppServer
SET JAVA_HOME=I:\WebSphere\AppServer\JDK\Jre
set WAS_CP=%WAS_CP%;%WAS_HOME%\lib\ejs.jar
set WAS_CP=%WAS_CP%;%WAS_HOME%\lib\ujc.jar
set WAS_CP=%WAS_CP%;%JAVA_HOME%\lib\classes.zip;
set WAS_CP=%WAS_CP%;hellowebsphereclient.jar;
rem start the client program
%JAVA_HOME%\bin\java -classpath %WAS_CP%;. com.ibm.ws.book.example.clients.HelloWebSphereEJBClient

Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
I think this may be unrelated to the previous problem. Can you post a short snippet of your code that obtains the initial context (and maybe the EJB home)?
Kyle
P.S. Are you SURE you are using the IBM JRE that's in the WebSphere directory to start your program!!?? This is important!!!
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Christine Li
Greenhorn

Joined: Sep 25, 2001
Posts: 9
Hi, Kyle
Thank you very much for your reply. I tested my code step by step. You are right that my problem was unrelated to my original one. Now let me readdress my problem in more detail:
1. I had e an EJB deployed on WebSphere 3.5.2
2. I wrote a RMI server implementation class which will call my EJB class.
3. I exported all classes as a JAR file and put it under application\servlet. And I exported RMI server implementation class and _stub as .class files and put them under application\web
4. I started Application server from WebSphere
5. I started rmiregistry:
set CLASSPATH=
c:\WebSphere\Appserver\jdk\jre\bin\rmiregistry
6. everything is running on the same machine.
I have problem to start my RMI server implementation class:
1. if my bach file:
include -Djava.rmi.server.codebase=C:/WebSphere\AppServer\hosts\default_host\application\web
I am getting error:
javax.naming.ServiceUnavailableException. Root exception is java.lang.NullPoint
erException
at com.ibm.CORBA.iiop.IOR.read(Unknown Source)
at com.ibm.CORBA.iiop.ClientResponseImpl.read_Object(Unknown Source)
at com.ibm.rmi.iiop.CDRInputStream.read_Object(CDRInputStream.java:728)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve(Unknown Source)
at com.ibm.CORBA.iiop.InitialNamingClient.cachedInitialReferences(Unknow
n Source)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve_initial_references(Unk
nown Source)
at com.ibm.CORBA.iiop.ORB.resolve_initial_references(Unknown Source)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initRootContext(CNInitial
ContextFactory.java:504)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNIniti
alContextFactory.java:274)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
71)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
)
at javax.naming.InitialContext.init(InitialContext.java:218)
at javax.naming.InitialContext.<init>(InitialContext.java:194)
2. if i remove the codebase setting from my bach file, of course it is not right. my RMI server class can read data from EJB home interface. but I am getting error:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: milos.ontology.OntoBrokerWrapper_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: milos.ontology.OntoBrokerWrapper_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: milos.ontology.OntoBrokerWrapper_Stub
java.lang.ClassNotFoundException: milos.ontology.OntoBrokerWrapper_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:248)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:358)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:167)
Do you have any idea how i should solve my problem? Could anybody else help? Thanks a lot!
Christine
Originally posted by Kyle Brown:
I think this may be unrelated to the previous problem. Can you post a short snippet of your code that obtains the initial context (and maybe the EJB home)?
Kyle
P.S. Are you SURE you are using the IBM JRE that's in the WebSphere directory to start your program!!?? This is important!!!

Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by Christine Li:
Hi, Please help
I deployed my CMP EJB in WebSphere3.5. I do not have problem to run servlet program which is also deployed in WebSphere3.5. but when i run my simple java class from JDK, my javaclass can not find the EJB home interface. I am getting NoClassDefError:
com.ibm.rmi.iiop.ORB
In my classpath setting, i put EJB client jar (exported from VisualAge for Java 3.5), UJC.jar from WebSphere/Appserver/lib (it includes CORBA.IIOP package). Could some one tell me what else I need add to the classpath?
or let me redress my question, could some one tell me which jar file of WAS3.5 contain com.ibm.rmi.iiop.ORB? or where can i find the file structure for WAS3.5?
Thank you very much for any kinds of suggestion.
Regards,


Hi,
rt.jar file contain the com.ibm.rmi.iiop.ORB class file which will be available in the following directory.("\Program Files\IBM\VisualAge for Java\ide\program\lib\rt.jar")
.
Regards,
M.S.Raman
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB in WebSphere