HI
I am trying to do a jndi look up for datasource from a standalone java client. The code for the same and printstack is as stated below.
Code
***********************
try
{
java.util.Hashtable parms = new java.util.Hashtable();
parms.put(
Context.PROVIDER_URL, "IIOP://10.10.50.175:900/" );
parms.put (Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
InitialContext ctx = new InitialContext(parms);
DataSource ds = (DataSource)ctx.lookup("sbcdatasource");
System.out.println("ds ::: " + ds);
}
catch(Exception e)
{
System.out.println("Exception e " + e.getClass().getName());
System.out.println("Exception e " + e.getMessage());
e.printStackTrace();
}
Stack trace
************************
Exception e java.lang.ClassCastException
Exception e com.ibm.ws.naming.util.CacheableReference
java.lang.ClassCastException: com.ibm.ws.naming.util.CacheableReference at com.metlife.renewal.datasource.RenewalConnection.createConnectionPool(RenewalConnection.java:108)at com.metlife.renewal.batch.BatchProcess.processRunOnce(BatchProcess.java:159)at com.metlife.renewal.batch.BatchProcess.startProcess(BatchProcess.java:73) at com.metlife.renewal.batch.BatchProcess.main(BatchProcess.java:52)
Have no idea where i am going wrong. can anybody help.
Regards
Makarand Parab
-
Problem with JNDI look up for datasource in Websphere (1 messages)
- Posted by: Makarand Parab
- Posted on: January 29 2005 17:13 EST
Threaded Messages (1)
- Classpath Problem by Srinivas K on December 12 2005 04:00 EST
-
Classpath Problem[ Go to top ]
- Posted by: Srinivas K
- Posted on: December 12 2005 04:00 EST
- in response to Makarand Parab
Solution for the problem. set CLASSPATH for \WebSphere\AppServer\lib\namingclient.jar, \WebSphere\AppServer\lib\cmImpl.jar, \WebSphere\AppServer\lib\j2cImpl.jar, \WebSphere\AppServer\properties
and Use IBM JDK in \WebSphere\AppServer\java. It is working for me.