Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 248797 - ClassCastException in Weblogic 10 when using blobs with Oracle
Summary: ClassCastException in Weblogic 10 when using blobs with Oracle
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Tom Ware CLA
QA Contact:
URL:
Whiteboard: submitted_patch
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-26 18:15 EDT by Sei Syvalta CLA
Modified: 2022-06-09 10:04 EDT (History)
3 users (show)

See Also:


Attachments
Simple patch to fix the ClassCastException (1.59 KB, patch)
2009-01-30 06:08 EST, Sei Syvalta CLA
peter.krogh: iplog+
Details | Diff
Proposed updates to submitted patch (2.06 KB, patch)
2009-06-18 11:11 EDT, Tom Ware CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sei Syvalta CLA 2008-09-26 18:15:33 EDT
Weblogic 10 seems to wrap blob in its own object, which causes ClassCastException when it is tried to be cast to oracle.sql.BLOB (wrapper class is weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB).

Not sure how to fix it, but it seems there is no need to cast it to Oracle specific type, just using java.sql.Blob should be enough.

Weblogic 10 MP1, Oracle 10. Stack trace follows:

Caused by: javax.persistence.RollbackException: java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
Caused by: java.lang.ClassCastException: weblogic.jdbc.wrapper.Blob_oracle_sql_BLOB
	at org.eclipse.persistence.platform.database.oracle.Oracle8Platform.writeLOB(Oracle8Platform.java:158)
	at org.eclipse.persistence.internal.helper.LOBValueWriter.fetchLocatorAndWriteValue(LOBValueWriter.java:86)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:597)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:500)
	at org.eclipse.persistence.internal.helper.LOBValueWriter.buildAndExecuteCall(LOBValueWriter.java:71)
	at org.eclipse.persistence.internal.helper.LOBValueWriter.buildAndExecuteSelectCalls(LOBValueWriter.java:182)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.flushSelectCalls(DatabaseAccessor.java:134)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:345)
	at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:163)
	at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:178)
	at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:465)
	at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
	at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
	at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:290)
	at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:666)
	at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:585)
	at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:114)
	at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:86)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2587)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1178)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1162)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1108)
	at org.eclipse.persistence.internal.sessions.CommitManager.commitNewObjectsForClassWithChangeSet(CommitManager.java:254)
	at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsForClassWithChangeSet(CommitManager.java:229)
	at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:185)
	at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3129)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1241)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:478)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1330)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:159)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1002)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
	... 43 common frames omitted
Comment 1 Sei Syvalta CLA 2008-10-07 07:21:03 EDT
This should work when setting the eclipselink.target-server (see http://forums.oracle.com/forums/thread.jspa?threadID=712370). However, I think the a better alternative could be to replace oracle specific type with java.sql.Blob.
Comment 2 Tom Ware CLA 2008-10-09 13:31:06 EDT
Changing to enhancement because this bug appears to indicate that the functionality works with the correct server platform.  The request is to make the behavior even easier to use.
Comment 3 Sei Syvalta CLA 2009-01-30 06:08:12 EST
Created attachment 124255 [details]
Simple patch to fix the ClassCastException

Attached a simple patch to fix the ClassCastException (tested with Weblogic 10 and Oracle 10). Would there be any chance to get it applied hopefully even for 1.1?

Both oracle.sql.BLOB and the the proxy returned by Weblogic implements java.sql.Blob, so there fix should be safe.
Comment 4 Sei Syvalta CLA 2009-02-19 02:12:17 EST
For reference, related bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=215254
Comment 5 Tom Ware CLA 2009-06-17 14:58:42 EDT
Investigating.

It looks like this fix will need to go in Oracle10Platform instead.  Previous versions of the JDBC driver did not support the necessary syntax.
Comment 6 Tom Ware CLA 2009-06-18 11:11:48 EDT
Created attachment 139554 [details]
Proposed updates to submitted patch
Comment 7 Tom Ware CLA 2009-06-18 11:21:04 EDT
Fix updates Oracle10Platform to use JDBC 3.0 API for LOBs

Tested by running full Core LRG

Reviewed by Tom Ware (reviewed user-submitted fix) with help from Peter Krogh
Comment 8 Peter Krogh CLA 2009-08-26 09:44:44 EDT
Mass update to change fixed in target.
Comment 9 Peter Krogh CLA 2009-08-26 09:47:05 EDT
Mass update to change fixed in target.
Comment 10 Peter Krogh CLA 2009-08-26 09:50:58 EDT
Mass update to change fixed in target.
Comment 11 Peter Krogh CLA 2009-08-26 09:53:17 EDT
Mass update to change fixed in target.
Comment 12 Eclipse Webmaster CLA 2022-06-09 10:04:17 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink