4

I recently upgraded an application to run using JAVA 7 and JBoss 7.1.1 This application was originally developed on JAVA 5 and Jboss 4.2.2. This application uses hibernate 3 for persistence.

On the new platform, the application is failing when there is an attempt to INSERT into a table with CLOB fields with the above error. I am using ojdbc14.jar (backend database Oracle 10.2.0.3)

These are things that I have verified in jboss 7.1.1 configuration:

  1. Creation of the correct module for Oracle. Ensured that ojdbc14.jar exists in the correct modules directory
  2. Ensured that there are no other conflicting ojdbc.jar existing anywhere else in the jboss directory
  3. Ensured that the application is not referring to a different ojdbc.jar.

Any insight would be helpful. I am pulling my hair trying to resolve this issue for almost a week now.

Thanks much

2
  • If you are doing anything "interesting" with classloaders you might have two instances of oracle.sql.CLOB loaded by two different classloaders. These would not be cast-compatible. Commented Jun 19, 2013 at 22:43
  • I am a rookie, could you please tell me how to check? I am not sure if this conflict is because of jBoss or hibernate. By default jboss refers to hibernate 3.6.6, but I have changed the reference to hibernate3.jar. How would you suggest steps for debugging? Thanks much. Appreciate any input. Commented Jun 20, 2013 at 15:02

3 Answers 3

7

I fixed the problem. Posting this answer, hoping it might be useful to someone.

When I was checking the instance type of the CLOB retrieved by the query, it came up as oracle.sql.CLOB. So I assumed it must have been a version mismatch of ojdbc.jar. I checked my project a gazillion times for multiple copies of the ojdb.jar. There were none.

Finally it turned out to be a clash between hibernate and ojdbc. I changed the reference to java.sql.Clob. Hibernate uses java.sql.Clob. This resolved the problem.

Sign up to request clarification or add additional context in comments.

2 Comments

are you saying in the hibernate mapping file you did something like this: <property name="comment" type="java.sql.Clob" column="COMMENT" />
No, this is in the import statement. I changed the import from oracle.sql.CLOB to java.sql.Clob.
0

In my situation i m not using Hibernate but i use Jboss like container and i had to remove the module of oracle from the jboss-deployment-structure.xml so i could not use anymore the oracle.sql.CLOB and i had the same probelm

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

in the end i used

 java.sql.Clob clobValue = (java.sql.Clob)result.getClob("EMIRFILE");

and works correctly. I hope this help someone.

Comments

0

In my case, the error was caused by an incorrect version of the ojdbc driver. When starting the server, the version is displayed in the early lines of the log, and it showed a higher version (12.2 -> ojdbc8.jar) than what should have been used (11.2 -> ojdbc6.jar). Making the change in the Wildfly configuration was sufficient to resolve the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.