3 Replies Latest reply on Feb 8, 2014 12:41 PM by Gaurav Chadha

    org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection

    Gaurav Chadha Newbie

      Hi,

       

      I am getting the below exception in my application when it is trying to pass the connection object to a stored procedure from java code.

       

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

              at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:160)

              at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:128)


      Environment details:

        I am using JDK 6, JBOSS EAP 6.1, Oracle 11g, OJDBC 11.2.0.2.0 jar


      To resolve this issue, i tried to unwrap the connection to OracleConnection with the below changes . Then i am getting the new below exception:



      procStmt.registerOutParameter(3, OracleTypes.CURSOR);

                 OracleConnection connection = dsconnection.unwrap(OracleConnection.class);

                    ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor("REQ_TYPE_ARRAY", connection);

      Exception:

      Failed to Execute java.sql.SQLException: Not a wrapper for: oracle.jdbc.OracleConnection


      Any help would be appriciated.

      Thanks in Advance!!!.