• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datasource Lookup from WSAD using POJO - CastException looking up DB2

Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to look up datasource from WSAD test server using stand alone POJO.

Code is like:

Hashtable properties = new Hashtable();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put(Context.PROVIDER_URL, serviceURL);
properties.put(Context.PROVIDER_URL, "iiop://localhost:2813");
Context context = new InitialContext(properties);
ds = (DataSource) context.lookup("jdbc/myDS");

Context and datasource are set properly.

I get exception below when I look up datasource:

Exception in thread "P=646891 =0:CT" java.lang.ClassCastException: javax.naming.Reference

I think additional jar files are needed in class path.

What additional jar files do I need in build path to look up datasource? I am using DB2 and datasource is properly configured in WSAD test server.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic