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

14,776

Solution 1

Two oracle jar files may be in your classpath. Please remove one jar and deploy again.

Solution 2

Sometime one JAR is in the application classpath and another is in the application server classpath (eg.: in Tomcat $CATALINA_HOME/lib)

Share:
14,776
Jordan Borisov
Author by

Jordan Borisov

Java developer from Bulgaria profile for Jordan Borisov at Stack Overflow, Q&A for professional and enthusiast programmers http://stackoverflow.com/users/flair/283114.png?theme=clean

Updated on September 16, 2022

Comments

  • Jordan Borisov
    Jordan Borisov over 1 year

    I have problem retrieving a blob object from oracle DB to java API with jdbc. The problem is when I execute a Collable statement with a function from the db which return me a blob field this exception is thrown on the line :

    tempBlob = (oracle.sql.BLOB)cstmt.getObject(1);

    with this error message :

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

    The object which I get from the DB is a instance of oracle.sql.BLOB. The tempBlob variable is a object oracle.sql.BLOB. Where is the problem?