I'm getting a java.io.InvalidClassException when I try to deserialize an object stored in a CLOB. The exception only happens when I connect with the OCI driver. We have to write the object w/ the OCI driver because the thin driver has a problem w/ writing CLOBs over 4K. If I use the thin driver, then it reads and deserializes just fine. Is there something wrong with the code I'm using to serialize/deserialize, or could it be some sort of parameter/setting I need to change/specify on the OCI driver?
Serialization code:
ByteArrayOutputStream writer = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(writer);
out.writeObject(message);
byte[] msgBytes = writer.toByteArray();
ByteArrayInputStream in = new ByteArrayInputStream(msgBytes);
Connection conn = datasource.getConnection();
PreparedStatement pstmt = conn.prepareStatement(WRITE_MESSAGE_SQL);
pstmt.setAsciiStream(MESSAGE, in, msgBytes.length);
pstmt.execute();
Deserialization code:
// rs is a ResultSet
Clob serializedMessage = rs.getClob(MESSAGE);
ObjectInputStream in = new ObjectInputStream(serializedMessage.getAsciiStream());
TextMessage jmsMessage = (TextMessage) in.readObject();
Of course, there are try/catches around everything and I'm closing all the IO/SQL objects in my finally block.
Any suggestions would be appreciated.
Thanks.
Eric