This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

J2EE Client not able to look up EJB

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My J2EE client is running in WSAD 5.0.0. My EJB is deployed on Websphere 5.0 Test Server in WSAD.

Here is the snippet of my code:
InitialContext context = new InitialContext(); Object objref = context.lookup("/ejb/com/fifththird/ebusiness/csoo/dataload/ejb/DataLoadServiceHome"); Object obj = PortableRemoteObject.narrow(objref, DataLoadServiceHome.class); DataLoadServiceHome home = (DataLoadServiceHome) obj; DataLoadService dataLoadService = home.create(); dataLoadService.loadFederalNoCall();

The exception is: javax.naming.NameNotFoundException: /ejb/com/fifththird/ebusiness/csoo/dataload/ejb/DataLoadServiceHome at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1503) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1457) at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1167) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132) at javax.naming.InitialContext.lookup(InitialContext.java:359) at com.fifththird.ebusiness.csoo.dataload.InvokeFederalLoad.main(InvokeFederalLoad.java:65) at java.lang.reflect.Method.invoke(Native Method) at com.ibm.websphere.client.applicationclient.launchClient.createContainerAndLaunchApp(launchClient.java:616) at com.ibm.websphere.client.applicationclient.launchClient.main(launchClient.java:420) at java.lang.reflect.Method.invoke(Native Method) at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)

Please let me know how the problem can be resolved?
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should lookup for the jndi-name of your ejb.
I don`t thing that this is your ejb jndi`s name.



Is it???

Usually, jndi names are somthing like this.


In the above example, the jndi name is DataLoadServiceBean.
 
Suma C S
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JNDI name is correct except that it should not start with a slash.
I changed that to "ejb/com.fi...." and it worked. :-))
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!