sobota, 19. december 2015

WebLogic server and java.lang.ClassCastException

I got this exception:
java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB cannot be cast to oracle.sql.BLOB.
It's because WLS properly wraps all vendor-specific types when using a connection pool. Oracle BLOB and CLOB are obviously Oracle specific types. Programmatic solution is usage of getVendorConnection() method.
Other solution is disabling type wrapping on WLS for specific data source.
  • Open WLS Administration Console and select right data source:

  •  Click on tab Connection Pool and expand Advanced settings at the bottom of the page:

  • Uncheck CheckBox Wrap Data Types (again at the bottom of the page) and save changes:


 We needed to restart WLS to activate change. Exception is gone!