Technote (troubleshooting)
Problem(Abstract)
When looking up a data source, getting a javax.naming.NameNotFoundException.
Symptom
Naming trace showing:
NameSpace < lookupInternal Exit
javax.naming.NameNotFoundException: Name "myDataSource " not found in context "myCell01/clusters/cluster1/jdbc".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1178)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:540)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:2163)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(_NamingContextStub.java:538)
at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2810)
at com.ibm.ws.naming.jndicos.CNContextImpl$2.run(CNContextImpl.java:2806)
at com.ibm.ws.naming.util.CommonHelpers.retry(CommonHelpers.java:771)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:2804)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1803)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1762)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1513)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:645)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:166)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:180)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.abc.xyz...JDBCDB.connect(JDBCDB.java:123)
Cause
There is a trailing space after the name of the data source myDataSource in the properties file that is used for the lookup. Note that the trace snippet above reveals the space.
Resolving the problem
Delete the trailing space in the property file above.
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.