• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Error in running EJB client code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My requirement is just to run this code with error free which is needed for our application. Server we were using Websphere6.1.

For runnng this client program we had include the following jars
bootstrap.jar
ecutils.jar
ffdc.jar
ibmorb.jar
idl.jar
iwsorb.jar
j2ee.jar
myClient.class
myClient.java
naming.jar
namingclient.jar
ras.jar
SonoraBeans.jar
tx.jar
txClient.jar
txClientPrivate.jar
utils.jar
wsexception.jar

This is our ejb client code.



we were pointing to IBM jre to run the above code.

While running up the code we ended up with the following exception

May 29, 2009 12:50:32 PM com.ibm.ws.naming.util.Helpers
WARNING: jndiNamingException
javax.naming.NamingException: Error during resolve [Root exception is java.lang.NullPointerException]
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1939)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1862)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1552)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1354)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
at javax.naming.InitialContext.lookup(InitialContext.java:363)
at com.example.myClient.main(myClient.java:23)
Caused by: java.lang.NullPointerException
at com.ibm.ws.security.auth.ContextManagerImpl.login(ContextManagerImpl.java:3233)
at com.ibm.ws.security.auth.ContextManagerImpl.login(ContextManagerImpl.java:3225)
at com.ibm.ws.security.auth.ContextManagerImpl.login(ContextManagerImpl.java:3014)
at com.ibm.ws.naming.jndicos.CNContextImpl$1.run(CNContextImpl.java:5072)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.naming.jndicos.CNContextImpl.login(CNContextImpl.java:5067)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4334)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1901)

Note : JNDI lookup name is correct, since the same code is working up in our client side, we assuming we were missing up of some jars or wrong jars may leads to this problem

Any clarification/suggestions will be welcomed.

Thanks in Advance
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, I have got little knowledge on EJB but I recommend you to start with this warning:


May 29, 2009 12:50:32 PM com.ibm.ws.naming.util.Helpers
WARNING: jndiNamingException



That is your lookup code


I usually do it like this


EARName is optional, only applies if you're looking up an EJB that's inside an EAR file.

I'm using EJB 3, I have never worked with EJB 2.1 ... hope it helps you!





 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In case of EJB 3 , client access the bean using the Depedency Injection (using the @EJB annotaiton). Can you explain to me how this work with the remote lookup ?

For example :
My ejb is deployed in Machine A
My client is in Machine B. If i use @EJB annotation in in my client code , how does my client get reference to the Remote bean ?


Regards,
Prannav.
 
Mateus Lucio
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, as far as I know the @EJB annotation only works for Local injection, if your client code is running outside the EJB Container which the Bean you are trying to lookup is deployed, the injection will fail ... see, you still have to provide the server location to make a bean lookup and unless you can configure it directly in @EJB annotation I can't imagine how it would work.

 
Prannav Santhosh
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help.
 
Right! We're on it! Let's get to work tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic