wood burning stoves 2.0*
The moose likes BEA/Weblogic and the fly likes ClassCast Exception at oracle.sql.BLOB.createTemporary Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "ClassCast Exception at oracle.sql.BLOB.createTemporary" Watch "ClassCast Exception at oracle.sql.BLOB.createTemporary" New topic
Author

ClassCast Exception at oracle.sql.BLOB.createTemporary

Priyam Srivastava
Ranch Hand

Joined: Oct 29, 2006
Posts: 169
Hi...

I am facing a problem that when I am trying to open a temporary BLOB, I am getting a ClassCastException. Below is a part of stack trace:


java.lang.ClassCastException: weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_1034_WLStub
at oracle.sql.BLOB.createTemporary(BLOB.java:684)


I am using Weblogic 10.3.4.0 with Jrocket 1.6 Update 24 in my JAVA_HOME.

Initially I thought this is a JDBC driver problem, then I tried with ojdbc14.jar, ojdbc5.jar, ojdbc6.jar but same result.

With more googling I found some other reasons like
Problem which seems to be that despite the fact that method BLOB.createTemporary takes a java.sql.Connection object as a parameter, it only works if the Connection is an oracle.jdbc.driver.OracleConnection object. If it's not an oracle.jdbc.driver.OracleConnection, then I get a ClassCastException.

I also found out that the problem happens because when I run my code in Weblogic and get the database connection via a DataSource object that I lookup via JNDI, the connection is not a real OracleConnection object, but an object that wraps the real OracleConnection.


Now the question is how do I solve this? In My DataSource->Connection Pool-> I have unchecked the "Wrap Data Types" and it still it doesn't work.

I would love to paste the code of how I am opening the Connection to be more understandable but due to my Company policy I cannot. Hope you all understand.

Feel free to ask me whatever details you want, but need a urgent solution for this.

Regards,
Priyam


"History would be kind to me, for I intend to write it."
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ClassCast Exception at oracle.sql.BLOB.createTemporary