Getting javax.naming.NameNotFoundException when use direct lookup of an EJB
 Technote (troubleshooting)
 
Problem(Abstract)
Using direct lookup to locate a EJB whose JNDI name is "ecourier.local.Account". Getting the javax.naming.NameNotFoundException, and here is a piece of the logs (whole trace file attached):

[11/3/05 18:15:53:093 EST] 0000002a Helpers 3 jndiNamingException
com.ibm.ws.naming.jndicos.CNContextImpl
lookupExt
wccpc101Node01Cell/nodes/wccpc101Node01/servers/server1
ecourier.local.Account
""
javax.naming.NameNotFoundException: Context: wccpc101Node01Cell/nodes/wccpc101Node01/servers/server1, name: ecourier.local.Account: First component in name ecourier.local.Account not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:542)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2213)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:4043)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1746)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1707)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1412)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1290)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at ejbs.RemoteSessionBean.remoteBusinessMethod(RemoteSessionBean.java:88)
at ejbs.EJSRemoteStatelessRemoteSession_d360130c.remoteBusinessMethod(EJSRemoteStatelessRemoteSession_d360130c.java:40)
at ejbs._RemoteSession_Stub.remoteBusinessMethod(_RemoteSession_Stub.java:255)
at TestServlet.doGet(TestServlet.java:74)
...
 
Cause
The EJB has a local interface but not a remote interface. Local interface is only available through indirect lookup (java:comp/env), not through direct lookup.
 
Resolving the problem
There are 2 ways to fix this problem. First and recommended way is to use indirect look up. Second way, if direct look up has to be used, is to create a remote interface for the EJB
 
Related information
NameNotFoundException during EJB lookup after deploying
 
trace.log
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > JNDI/Naming
Operating system(s): Windows
Software version: 6.0.2.3
Software edition:
Reference #: 1233726
IBM Group: Software Group
Modified date: Mar 31, 2006