NameNotFoundException when looking up a web service reference
 Technote (troubleshooting)
 
Problem(Abstract)
After deploying a Web service client, the following exception is thrown when trying to do a lookup of the Web service reference:


[3/3/06 18:34:49:864 CST] 000000a6 SystemErr R javax.naming.NameNotFoundException: Name comp/env/service not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal
(NameSpace.java:1766)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal
(NameSpace.java:1082)
at com.ibm.ws.naming.ipbase.NameSpace.lookup
(NameSpace.java:990)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup
(UrlContextImpl.java:1263)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup
(javaURLContextRoot.java:201)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup
(javaURLContextRoot.java:142)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
 
Resolving the problem
If the Web service is running as a managed client (EJB or Servlet), the lookup of the Web service must be performed in the Servlet or EJB. In the failing case above, a servlet was calling a class included with the Web application in a utility jar file.

Because the lookup was being performed outside of the J2EE thread where the service reference was bound, the NameNotFound exception was thrown.

To resolve the problem, the lookup was moved into the servlet code and then passed to the class in the utility jar for further processing.

 
 
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
Software edition:
Reference #: 1236077
IBM Group: Software Group
Modified date: Apr 21, 2006