[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - WrappedDataSource class cast exception in jboss 5.1

meetoblivion do-not-reply at jboss.com
Thu May 14 08:32:04 EDT 2009


So I'm using JBoss 5.1 CR1 and I've got a small bit of code that looks like this:

			Object ds = ctx.lookup("HRDS");
  | 			log.error("The class type is: "+ds.getClass().getCanonicalName());
  | 			DataSource hr = (DataSource)ctx.lookup("HRDS");

when the log statement is written, I see org.jboss.resource.adapter.jdbc.WrapperDataSource which is what I expect, so it can in fact find the datasource.

However, when I try to cast it to javax.sql.DataSource

 Generic exception:  ^%^ >>>stack of 1.cause::java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource

I thought wrapped data source extended DataSource?  Also, my Hibernate connections can work with it fine.  hmmm

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231070#4231070

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231070



More information about the jboss-user mailing list