javax.naming.NameNotFoundException looking up a data source due to trailing space in data source name in properties file

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:

(0 users)Average rating

Add comments

Document information


More support for:

WebSphere Application Server
JNDI/Naming

Software version:

6.1, 7.0, 8.0, 8.5

Operating system(s):

AIX, Linux, Solaris, Windows

Software edition:

Base, Network Deployment, Single Server

Reference #:

1628827

Modified date:

2013-03-22

Translate my page

Machine Translation

Content navigation