java.lang.ClassCastException: com.ibm.ejs.ns.jndi.CNContextImpl

Technote (FAQ)
Problem
When trying to access a DataSource with a JNDI lookup, a java.lang.ClassCastException: com.ibm.ejs.ns.jndi.CNContextImpl occurs.
Solution
The reason is the DataSource name for the lookup is not completely specified. If you lookup "jdbc/" instead of "jdbc/dataSourceName", then you will get this error when trying to cast the returned object to DataSource. "jdbc" is of type com.ibm.ejs.ns.jndi.CNContextImpl.











Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Servlet Engine/Web Container
Operating system(s): All Platforms
Software version: 3.5
Software edition: Standard, Advanced
Reference #: 1040785
IBM Group: Software Group
Modified date: 2002-06-06