• Post Reply Bookmark Topic Watch Topic
  • New Topic

ClassCast Exception at oracle.sql.BLOB.createTemporary  RSS feed

Priyam Srivastava
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!