title: ClassCastException: org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6 cannot be cast to OraclePreparedStatement
body: <p>I'm working to migrate an application from Oracle Application Server to JBoss EAP 6.1. I have most things working but I am getting one error that I haven't been able to figure out:</p>
  
  <pre><code>13:27:29,743 ERROR [com.myproj.db.dao.myDao] (Thread-164) Get Prepared Statement: 
  java.lang.ClassCastException: 
  org.jboss.jca.adapters.jdbc.jdk6.WrappedPreparedStatementJDK6 cannot be cast
  to oracle.jdbc.internal.OraclePreparedStatement
  </code></pre>
  
  <p>I have Oracle set up as a module in JBoss for connection pooling using <code>ojdbc6.jar</code> (and it works for other parts of the application), but for the one part of the application that uses an <code>OraclePreparedStatement</code>, it gets the error.</p>
  
  <p>I did make certain that there is no <code>ojdbc6.jar</code> file in the WAR file.  The only one in JBoss seems to be inside of the module.</p>
  
  <p>I did try changing the <code>OraclePreparedStatement</code> class to <code>oracle.jdbc.OraclePreparedStatement</code>, but the results are the same.</p>
  
  <p>I did try running with TRACE on for logging to see where classes were loading from. <code>OraclePreparedStatement</code> was loaded from the module with the exception of this line:</p>
  
  <pre><code>4:31:40,583 TRACE [org.jboss.modules] (Thread-84) Finding class 
  oracle.jdbc.OraclePreparedStatement from Module "deployment.myProj.war:main" from
  Service Module Loader
  </code></pre>
  
  <p>Here's a link to an <a href="https://dl.dropboxusercontent.com/u/60041598/trace%20classloader%20info.txt" rel="nofollow">excerpt of the log</a> - basically just the lines related to <code>OraclePreparedStatement</code>.</p>
  
  <p>I have confirmed that there is no <code>ojdbc6.jar</code> (or any Oracle related jars) in the WAR file, and there is no <code>OraclePreparedStatement</code> class inside of the WAR file either.</p>
  
  <p>I do have the module listed as a dependency in my JBoss deployment structure xml file.</p>
  
  <p>Anyone have any ideas?</p>