-
1. Re: ClassCastException getting datasource
raj_skromis Mar 5, 2002 5:51 AM (in response to admiyo)it seems your driver class does not support XADataSourse
transaction -
2. Re: ClassCastException getting datasource
admiyo Mar 5, 2002 10:37 PM (in response to admiyo)No, the class cast is the other way around.
I think it has to do withgetting the Datasource from within the Tomcat realm, as opposed to in the JBoss side of things. -
3. Re: ClassCastException getting datasource
davidjencks Mar 6, 2002 1:08 AM (in response to admiyo)Well, what happens if you take the jar with the jdbc classes out of tomcat? I don't really understand the details of the latest servlet classloader requirements, but I think they may require to try to load the class locally first. This would give an incompatible class to what you looked up in jndi.
-
4. Re: ClassCastException getting datasource
admiyo Mar 6, 2002 7:20 PM (in response to admiyo)Here is our workaround:
try{
//TODO:Refactor tyhis code into the EJB Layer
org.jboss.pool.jdbc.xa.XAPoolDataSource source
=
/*THis call should be an XADatasource, not the jboss specific one*/
(org.jboss.pool.jdbc.xa.XAPoolDataSource)getInitialContext().
lookup(datasourceName);
connection = source.getConnection();
for (ResultSet results = perform(connection); results.next();){
add(new Value(results.getObject(1),results.getString(2)));
}
connection.commit();
}catch(Exception e){
e.printStackTrace();
try{
if (connection != null){
connection.rollback();
}
}catch (SQLException rollbackE){
System.out.println("ERROR:Could not rollback");
}
}finally{
try{
if (connection != null){
connection.close();
}
}catch (SQLException e){
e.printStackTrace();
}
} -
5. Re: ClassCastException getting datasource
davidjencks Mar 6, 2002 7:41 PM (in response to admiyo)your comment should read, /*This cast should be to the Datasource interface, not the jboss implementation*/
XAPoolDataSource is a DataSource implementation in front of some pooling + an XADataSource. It is not an XADataSource.