I ran into an aggravating problem, here are the facts -
I am registering a parameter of the return parameter, and for this I am using java.sql.PreparedStatement for oracle.jdbc.OraclePreparedStatement.
((OraclePreparedStatement) getStatement()) .registerReturnParameter(index, sqlType);
This works great when I run it from Eclipse, and it works even on our development server. However, when I port it to our test server, where I find an unexpected error ...
oracle.jdbc.driver.OraclePreparedStatementWrapper cannot be cast to oracle.jdbc.OraclePreparedStatement
This is an incredibly strange error for me, because I am sure that OraclePreparedStatement can be assigned from getStatement (). I debugged and found this to be TRUE for all environments:
//class oracle.jdbc.driver.OraclePreparedStatementWrapper getStatement().getClass();
LOCAL and DEV environments use the DataSource, which I installed in META-INF / context.xml:
<Resource name="dataSource/dbsubm" auth="Container" type="oracle.jdbc.xa.client.OracleXADataSource" factory="org.apache.naming.factory.BeanFactory" user="*****" password="******" URL="jdbc:oracle:thin:@host:port:db" />
The TEST environment is different in that it has a DataSource coming from server.xml, although the configuration is exactly the same. This is for me the only difference between these environments.
What could be the problem? Why am I getting a ClassCastException using the same code, but in different environments? Using getClass (), I can say that they are all of the same type ... please help!