0

I have the following problem:

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

I did try to add the ironjacamar-jdbc-1.0.17.Final-redhat-1.jar in the project-tree under lib.

When I deploy the project I get the following exception:

org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6 cannot be to org.jboss.jca.adapters.jdbc.jdk6.WrappedConnectionJDK6

The code where the exception occurs:

java.sql.Connection connection =  ds.getConnection();
WrappedConnection c =  ((WrappedConnection)connection).getUnderlyingConnection();
OracleConnection conn = (OracleConnection) c;

I did add a new file, jboss-deployment-structure.xml, with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure> 
    <deployment>
        <dependencies>
            <module name="org.jboss.ironjacamar.jdbcadapters" slot="main"/>
            <module name="com.oracle.ojdbc6" slot="main"/>
        </dependencies>
    </deployment> 
</jboss-deployment-structure>

In this case i get:

moduleloading error can not load 

<module name="com.oracle.ojdbc6" slot="main"/

Manifest.MF:

Manifest-Version: 1.0
Class-Path: 
Dependencies:  org.jboss.ironjacamar.jdbcadapters

Removing

<module name="com.oracle.ojdbc6" slot="main"/>

I get

oracle.jdbc.driver.T4CConnection cannot be cast to oracle.jdbc.OracleConnection

It want cast everything to everything JBoss kidding me ?

Can you tell me what I have to do in order to get an OracleDamnedConnection ?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
FrankTan
  • 1,626
  • 6
  • 28
  • 63
  • Possible duplicate: http://stackoverflow.com/questions/10247702/java-lang-classcastexception-org-jboss-jca-adapters-jdbc-jdk6-wrappedconnection – patstuart Nov 25 '13 at 17:12

2 Answers2

1

in the file jboss-deployement-structure.xml

you i had to write:

 <?xml version="1.0" encoding="UTF-8"?>
 <jboss-deployment-structure> 
 <deployment>
 <dependencies>
 <module name="org.jboss.ironjacamar.jdbcadapters" slot="main"/>
 <module name="com.oracle" />

 </dependencies>

 </deployment> 
 </jboss-deployment-structure>

because it has to match the path of the jar ojdbc, last folder was Main. and it looks inside Main. so i had the path /com/oracle/main/ojdbc.jar

FrankTan
  • 1,626
  • 6
  • 28
  • 63
1

I solved it by editing the jboss-deployment-structure.xml file:

<dependencies>
     <module name="org.jboss.ironjacamar.jdbcadapters" slot="main"/>
     <module name="com.oracle.ojdbc6" slot="main"/> 
</dependencies>
  • How does this differ from the configuration the OP originally reported as not working? It’s possible that this works now, on a newer version, over six years later. But it’s not really a solution to the original problem if it uses the exact same configuration that the OP was reporting an error with. Am I missing something? – Jeremy Caney May 12 '20 at 05:29