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 Websphere and the fly likes RMI-IIOP with Websphere naming server in WAS 3.5 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 » Products » Websphere
Bookmark "RMI-IIOP with Websphere naming server in WAS 3.5" Watch "RMI-IIOP with Websphere naming server in WAS 3.5" New topic
Author

RMI-IIOP with Websphere naming server in WAS 3.5

francisk
Greenhorn

Joined: Feb 18, 2002
Posts: 8
I am coding an application that are using rmi-iiop, and using the Websphere naming server in WAS 3.5. After I installed the remote implementation code to the server, I test the client code from VA-Java, every things working fine. But when I export the client code to the jdk1.3.1 environment, it cannot able to look up the server and throw an exception like this...
javax.naming.NamingException: Error during resolve. Root exception is
java.lang.NullPointerException
at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:726)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:584)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.wea.leave.system.ListenerRunnerClient.main(ListenerRunnerClient.java:50)
Error during resolve
null
java.lang.NullPointerException
also I am using com.ibm.ejs.ns.jndi.CNInitialContextFactory. I have no idea why everythings working in VA-java env. but not working when I am just using the JDK. I really need to app to run in the JDK env. Am I missing any configuration need to be set before I run it in the command prompt? Thanks for any advice.
Francis Kwok
hwkwok@chorus.net
[ February 18, 2002: Message edited by: francisk ]
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
JDK 1.3 may give you a problem. Try using the JRE in WebSphere first. Are you sure you have everything you need on the classpath of your application? Would you mind posting your classpath?
Kyle
[ February 18, 2002: Message edited by: Kyle Brown ]

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.
francisk
Greenhorn

Joined: Feb 18, 2002
Posts: 8
Kyle,
Here is the classpath in the DOS env.
C:\>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
classpath=;%CLASSPATH%;.
CommonProgramFiles=C:\Program Files\Common Files
ComSpec=C:\WINNT\system32\cmd.exe
EXT=
FILE_SERVER=WEAAPPS1
HOMEDRIVE=C:
HOMEPATH=\
IMNINST=help
IMNINSTSRV=C:\IMNnq_NT
include=;%INCLUDE%;.
lib=;%LIB%;.
maprootoff=1
NLSPATH=C:\IBM Connectors\Encina\%L\%N
NUMBER_OF_PROCESSORS=1
NWLANGUAGE=English
OS=Windows_NT
Os2LibPath=C:\WINNT\system32\os2\dll;
Path=;C:\IBMCON~1\CICS\BIN;;C:\IBM Connectors\Encina\bin;;C:\WINNT\system32;C:\W
INNT;C:\WINNT\System32\Wbem;C:\WINNT\system32\nls;C:\WINNT\system32\nls\English;
C:\PROGRA~1\IBM\CLIENT~1;C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~
1\Emulator;;C:\IMNnq_NT;Z:.
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0806
ProgramFiles=C:\Program Files
PROMPT=$P$G
SystemDrive=C:
SystemRoot=C:\WINNT
windir=C:\WINNT
Here is my testing sequence.
Also I am using VA-Java ver. 3.5 and when I run the code out side of VAJ, I export it to c:\temp
dir
1.
naming server: tnameserv (from JDK1.3.1)
ContextFactory: com.sun.jndi.cosnaming.CNCtxFactory
Client: localhost (my workstation) in DOS env.
Server: localhost (my workstation) in DOS env.
result: success, without any problem
2.
naming server: WAS 3.5 naming server
ContextFactory: com.ibm.ejs.ns.jndi.CNInitialContextFactory
Client: (my workstation) inside VA-Java env.
Server: WAS 3.5 server
result: success, without any problem
3.
naming server: WAS 3.5 naming server
ContextFactory: com.ibm.ejs.ns.jndi.CNInitialContextFactory
Client: (my workstation) in DOS env.
Server: WAS 3.5 server
result: the problem describe above.
do I need to add extra class path?
Francis Kwok
francisk
Greenhorn

Joined: Feb 18, 2002
Posts: 8
I found out that I am using a different ver. of JDK than the WAS 3.5 using. So I tried it with the same ver. of JDK, this time, no more exception from creating the initialContext. Now it can look up to the object, but when I tried to execute the remote method. It throw a MarshalException... not sure what it is, I can give more detail later. Anyone know what that exception mean?
Francis Kwok
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Unfortunately, you still haven't posted your classpath -- %Classpath% doesn't give me any information. My book contains an example of a batch file to launch a Java client to connect to a WebSphere 3.5 EJB. I'm pretty sure i've posted that batch file to JavaRanch at one point so you might want to search for it. You might want to use something like that so you know exactly what is on your classpath.
Kyle
francisk
Greenhorn

Joined: Feb 18, 2002
Posts: 8
Oops...
here is the class path
classpath=;C:\IBMCON~1\CICS\Classes\CTGCLI~1.JAR;C:\IBM Connectors\classes;;.
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=FRANCIS-KWOK
ComSpec=C:\WINNT\system32\cmd.exe
I got your book, let me take a look first. But is there any difference between connecting to EJB and rmi remote object? Because I tried to solve this problem using a stateless session bean and it can successfully run under the JDK1.2.2, but on the other hand when I run the rmi remote method, it just give me that MarshelException. Anyway, I will take a look on your book first. Thanks!
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
The answer is YES there is a BIG difference between connecting to an EJB and an RMI object. The standard JDK contains the classes for RMI over it's native protocol. Only the IBM classes (which are not on your classpath) contain the classes for RMI over IIOP; like, for instance, the IBM ORB...
Kyle
Tony Chen
Ranch Hand

Joined: Jan 29, 2001
Posts: 286
VAJ v3.5 uses IBM JDK v1.2.2, so you'd better try your applicaton with IBM JDK v1.2.2.
IBM JDK v1.3.0 might work, but I doubt if SUN JDK v1.3.0 or v1.3.1 will work for you.
Here's what I got for IBM JDK v1.2.2 extensions:
C:\IBM\WebSphere\WAS35\AppServer\jdk\jre\bin>java -version
java version "1.2.2"
Classic VM (J2RE 1.2.2 IBM build cn122-20010629 (JIT enabled: jitc))
C:\IBM\WebSphere\WAS35\AppServer\jdk\jre\lib\ext>dir
Volume in drive C is C_drive
Volume Serial Number is 84E6-FEE3
Directory of C:\IBM\WebSphere\WAS35\AppServer\jdk\jre\lib\ext
02/18/2002 08:14p DIR .
02/18/2002 08:14p DIR ..
02/18/2002 08:10p 21,942 cosnaming.jar
02/18/2002 08:10p 150,170 iiimp.jar
02/18/2002 08:10p 462,044 iioprt.jar
02/18/2002 08:10p 13,468 JawBridge.jar
02/18/2002 08:10p 97,156 jndi.jar
02/18/2002 08:10p 77,110 providerutil.jar
02/18/2002 08:10p 320,279 rmiorb.jar
02/18/2002 08:10p 15,400 rmiregistry.jar
02/18/2002 08:10p 11,544 testinputmethod.jar
9 File(s) 1,169,113 bytes
2 Dir(s) 2,690,064,384 bytes free
And for IBM JDK v1.3.0 extensions:
C:\IBM\WebSphere\WAS40\AppServer\java\jre\bin>java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Classic VM (build 1.3.0, J2RE 1.3.0 IBM build cn130-20010925was (JIT enabled: ji
tc))
C:\IBM\WebSphere\WAS40\AppServer\java\jre\lib\ext>dir
Volume in drive C is C_drive
Volume Serial Number is 84E6-FEE3
Directory of C:\IBM\WebSphere\WAS40\AppServer\java\jre\lib\ext
02/21/2002 06:32p DIR .
02/21/2002 06:32p DIR ..
02/21/2002 06:32p 45,386 activation.jar
02/21/2002 06:32p 547,350 gskikm.jar
02/21/2002 06:32p 71,154 ibmjcefw.jar
02/21/2002 06:32p 657,622 ibmjceprovider.jar
02/21/2002 06:32p 203,926 ibmjsse.jar
02/21/2002 06:32p 701,449 ibmorb.jar
02/21/2002 06:32p 533,718 ibmpkcs.jar
02/21/2002 06:32p 43,606 indicim.jar
02/21/2002 06:32p 13,432 JawBridge.jar
02/21/2002 06:32p 1,928 local_policy.jar
02/21/2002 06:32p 234,333 mail.jar
02/21/2002 06:32p 1,937 US_export_policy.jar
12 File(s) 3,055,841 bytes
2 Dir(s) 2,714,886,144 bytes free
And for SUN JDK v1.3.1:
D:\Java\jdk1.3.1_01\jre>bin\java -version
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
D:\Java\jdk1.3.1_01\jre\lib\ext>dir
Volume in drive D is D_drive
Volume Serial Number is 9860-7624
Directory of D:\Java\jdk1.3.1_01\jre\lib\ext
02/21/2002 08:46p DIR .
02/21/2002 08:46p DIR ..
0 File(s) 0 bytes
2 Dir(s) 2,702,118,912 bytes free
There's nothing in the JUN JDK's extenion dir!
[ February 21, 2002: Message edited by: Tony Chen ]

SCJP Java 2 - IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0 - IBM Certified System Administrator - WebSphere Network Deployment V6.0 - Canadian Securities Course (CSC) Certification
 
 
subject: RMI-IIOP with Websphere naming server in WAS 3.5
 
Similar Threads
Error in running EJB client code
Accessing EJB on websphere 3.5 from Java Client
javax.naming.NamingException: Error during resolve. Root exception is com.ibm.ejs.jt
Ejb client code error during lookup-websphere
Getting a DataSource outside of WAS3.5 vi JNDI