Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

J2EE Client not able to look up EJB

 
Suma C S
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?
 
Leandro Melo
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. :-))
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic