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

JDBC 4 added the wrap/unwrap API, you need to use the API to get to the underlying connection.

Facing this problem migrating a ADF 11.1 to EAP 6.4, any hint on how to solve it?

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.