title: ClassCastException - oracle.jdbc.OraclePreparedStatement
body: <p>I'm encountering an aggravating issue, here's the facts - </p>
  
  <p>I'm registering a return parameter specific and to do so I'm casting a java.sql.PreparedStatement to oracle.jdbc.OraclePreparedStatement.</p>
  
  <pre><code>((OraclePreparedStatement) getStatement())
      .registerReturnParameter(index, sqlType);   
  </code></pre>
  
  <p>This works great when I run this from Eclipse and it even runs as expected on our development server.  However, it's when I move it to our testing server where I hit an unexpected error...</p>
  
  <pre><code>oracle.jdbc.driver.OraclePreparedStatementWrapper cannot be cast
   to oracle.jdbc.OraclePreparedStatement
  </code></pre>
  
  <p>It's incredibly strange error to me because I'm sure that OraclePreparedStatement is assignable from getStatement().  I've debugged and found that this is TRUE for all environments:</p>
  
  <pre><code>//class oracle.jdbc.driver.OraclePreparedStatementWrapper
  getStatement().getClass();
  </code></pre>
  
  <p>LOCAL and DEV environments both use a DataSource I've set up in META-INF/context.xml:</p>
  
  <p></p>
  
  <pre><code>&lt;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" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>TEST environment differs because it has a DataSource coming from server.xml even though the configuration is exactly the same.  This to me is the only difference between these environments.</p>
  
  <p>What could be the issue?  Why do I get a ClassCastException using the same code but different environments?  Using getClass() I can tell that they are all the same type... please help!</p>