5 Replies Latest reply on Jun 25, 2017 9:50 PM by haitun68888

    jboss eap 6.4 oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY

    haitun68888

      JBoss EAP 6.4 standalone server

      Application deployed as a war file throws a runtime exception

      java.lang.ClassCastException: oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY

      at line

      ARRAY a = (ARRAY) cs.getArray(1);

       

      JDBC libary included is ojdbc14.jar (WEB_INF/lib). All libraries are included in the war file and there are no "global" libaries setup on the server. I have verified no other jdbc libraries are included anywhere in the app.

      In order to create a JDBC datasource, i created a deployment for ojdbc14.jar. This is the only possible source of conflict i can think of. When i remove the ojdbc14.jar from the war file, i get a ClassNotFound exception in place of the ClassCastException.

      Every other part of the app works fine except this line. How do i debug this any further?

      I have try something ,but not work:

      (1)add a jboss-deployment-structure.xml into web-inf/.

      <?xml version="1.0" encoding="UTF-8"?> 

      <jboss-deployment-structure> 

          <deployment> 

               <dependencies> 

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

              </dependencies> 

          </deployment> 

      </jboss-deployment-structure>

      not work and the war dont write the log too.

        • 1. Re: jboss eap 6.4 oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY
          andey

          1) Check if the class loaders are the same by comparing the

          cs.getArray(1) classloader  and oracle.sql.ARRAY.class.getClassLoader() If you do equals between the two classloaders, it should return false as it looks that the classloaders are different.

              

          This problem has already been reported earlier in another forum at https://forums.oracle.com/message/9330314. Moving jars around in jboss will still result in same problems.

           

          2) Find out the source jars from where the classes are getting loaded and remove the jar that you dont need. Find the jars for the two different classes by checking

           

          Possible Solutions:

          a) If you  can't get classes to be loaded as you expect, Specify the library in jboss server library.

          b) The last solution to force classes to be loaded from a particular jar is by specifying the jar in the bootclasspath.

          • 2. Re: jboss eap 6.4 oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY
            lafr

            Does "I created a deployment for ojdbc14.jar" means, you copied this file to the deployments folder?

            Then the module name for jboss-deployment-structure.xml is "deployment.ojdbc14.jar".

            Then remove ojdbc14.jar from your war file.

            • 3. Re: jboss eap 6.4 oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY
              haitun68888

              Thank you for your help.I have check the class loaders ,they are not equals.The ojdbc14.jar has contained in two :the WEB_INF/lib in the war file ,and in the jboss for creating module of it to create a JDBC datasource.

              When i remove the jar from my application , i get a ClassNotFound exception in place of the ClassCastException.

              • 4. Re: jboss eap 6.4 oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY
                lafr

                In case of ClassNotFoundException your dependency to the module is not correct.

                What's the complete path? $JBOSS_HOME/modules/com/oracle/main containing module.xml and ojdbc14.jar?

                Show module.xml.

                • 5. Re: jboss eap 6.4 oracle.sql.ARRAY cannot be cast to oracle.sql.ARRAY
                  haitun68888

                  Hello,my complete pathis:$JBOSS_HOME/modules/system/layers/base/com/oracle/main/.And my module.xml is:

                  <?xml version="1.0" encoding="UTF-8"?>

                  <module xmlns="urn:jboss:module:1.1" name="com.oracle">

                      <properties>

                          <property name="jboss.api" value="unsupported"/>

                      </properties>

                   

                      <resources>

                          <resource-root path="ojdbc14.jar"/>

                          <!-- Insert resources here -->

                      </resources>

                      <dependencies>

                          <module name="javax.api"/>

                          <module name="javax.transaction.api"/>

                          <module name="javax.servlet.api" optional="true"/>

                      </dependencies>

                  </module>