hi, i need to access EJB deployed on WAS 3.5 advanced from a java stand alone client. I have included the following jar files in the clientclasspath..admin.jar,ejs.jar,ns.jar,repository.jar,ujc.jar and i am using jdk provided with WAS.. When i run my client application it gives the following exception javax.naming.NamingException: Error during resolve. Root exception is java.lang.NullPointerException at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:744) at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:590) at javax.naming.InitialContext.lookup(InitialContext.java:350) at TestClient.main(TestClient.java:34) please help me out, Gowrish
It's hard to tell what's wrong without seeing your code, but here are my thoughts: - your error message states "Root exception is java.lang.NullPointerException" at "TestClient.main(TestClient.java:34)". - In TestClient.java, how exactly are you calling InitialContext.lookup()? Are you passing in a null variable? -miftah
posted 18 years ago
hi Miftah Khan, Thanks for the reply.. so i am now pretty sure that somebody in the world is there to help me out.. The code for look up is : java.util.Properties hashTable = new java.util.Properties(); hashTable.put(javax.naming.Context.PROVIDER_URL,"iiop://hcl-rti006:900"); hashTable.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory"); InitialContext ctx = new InitialContext(hashTable); Object objref = ctx.lookup("LOGIN"); home= (LoginHome) PortableRemoteObject.narrow ((org.omg.CORBA.Object)objref,LoginHome.class); I get this exception when i try to lookup for jndi name "LOGIN" The same jndi works fine in a servlet Thanks in advance Gowrish
I'm puzzled.. the only things I can think of is.. Are you doing anything differently between the servlet and the ejb, like having an ejb-ref in web.xml but no corresponding ejb-ref in ejb-jar.xml? Good luck.
[This message has been edited by Miftah Khan (edited October 04, 2001).]
posted 18 years ago
hi, what i mean to say in my previous posting is when i try to lookup the ejb from the servlet, it works fine. but when i try to do the same from a java client it gives the above mentioned exception gowrish [This message has been edited by gowrish bhaskar (edited October 05, 2001).]
OK, this is probably a stupid question (but those questions often end up having interesting ramifications) but are the Java client and the Servlet running on the same machine? If not, can you ping the hostname that you've given in the iiop://hostname:900 line from the machine that you are running the client on?