java.lang.ClassCastException: org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection

Latest response

We are getting ClassCastException org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection
while using the Data Source with Jboss EAP 6.3

Below are the configuration details :

Java version : 1.7
Oracle : 12c (ojdbc7.jar)
Jboss : EAP 6.3
Exception : org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection
We make sure that there is only one version of the Oracle (only ojdbc7.jar) we dont have classes12.jar in the project build path.

Added the following in my jboss-deployment-structure.xml for my WAR deployment even thought still getting the exception as below:

<jboss-deployment-structure>
   <sub-deployment name="TEST.war">
        <dependencies>
            <module name="org.jboss.ironjacamar.jdbcadapters" />
        </dependencies>
    </sub-deployment>
</jboss-deployment-structure>
DataSource Creation:
     InitialContext ctx = null;
     DataSource dataSource = null;
     try {
      if (conn == null) {
          logger.debug("In DbConnectionFactory.getDataSource() After InitialContext");
      dataSource = (DataSource)new InitialContext().lookup("java:jboss/datasources/TestDS");
      conn = dataSource.getConnection();
      conn.setAutoCommit(false);
    }   

This below line throws the class cast exception .

 Array array_to_pass = ((OracleConnection)conn).createOracleArray("STRING_ARRAY",testArray);

** Please do let us know what is wrong with this configuration ?**

Responses