• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing EJB on websphere 3.5 from Java Client

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

------------------
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
That is a really big piece of pie for such a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic