File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing EJB on websphere 3.5 from Java Client

 
gowrish bhaskar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

------------------
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
 
gowrish bhaskar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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).]
 
gowrish bhaskar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic