RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.59k stars 247 forks source link

Exception serializing cachedRowSetImpl with clob w/ 2.48-jdk-6 #209

Open ebrandsberg opened 7 years ago

ebrandsberg commented 7 years ago

I'm working on a project where we are using FST to serialize objects of type cachedRowSetImpl, but when the object contains a clob field, we are getting:

Exception: java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.nustaq.serialization.FSTObjectOutput.writeObjectCompatibleRecursive(FSTObjectOutput.java:547) org.nustaq.serialization.FSTObjectOutput.writeObjectCompatible(FSTObjectOutput.java:535) org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:442) org.nustaq.serialization.FSTObjectOutput.writeArray(FSTObjectOutput.java:776) org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:419) org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:361) org.nustaq.serialization.FSTObjectOutput.writeObjectFields(FSTObjectOutput.java:640) org.nustaq.serialization.FSTObjectOutput.defaultWriteObject(FSTObjectOutput.java:527) org.nustaq.serialization.FSTObjectOutput.writeObjectWithContext(FSTObjectOutput.java:447) org.nustaq.serialization.FSTObjectOutput.writeObjectInternal(FSTObjectOutput.java:319) org.nustaq.serialization.serializers.FSTCollectionSerializer.writeObject(FSTCollectionSerializer.java:54) ...

All other field types tested so far work fine (although I'd need to check blobs as well). Any thoughts on how to resolve this? There is a java 6 compatibility requirement--using 1.63 resulted in the same error. Thanks!

RuedigerMoeller commented 7 years ago

Hi, could you provide a test case? I need the source of the "clob" class (because the issue is likely located in the read/writeObject methods of this class).

An easy workaround is the creation of a custom serializer for the problematic class (see docs).

I currently don't backport any bugfixes to the java-6 compatible versions.

ebrandsberg commented 7 years ago

Thanks for replying. The clob class is from the Java runtime for the cachedRowSetImpl, and is javax.sql.rowset.serial.SerialClob. Source for this is at http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/javax/sql/rowset/serial/SerialClob.java/. The actual version of java being used in the case I am seeing this is 1.8.0_102-b14, although our code needs to provide support back to java 6, so I am already using the java6 backport of the 2.x build tree that you referenced.

As this is a class that is part of the java runtime, I figured it would be of interest to you. I can try to craft a test case for this, as the setup I'm using to get this error is quite involved, but I may have to do this later this week.

RuedigerMoeller commented 7 years ago

Hi, i looked into the impl and they use very outdated getField / putfield semantics. A custom serializer will be required, I'll drop one in this issue as I find time

ebrandsberg commented 7 years ago

Thanks! This is very much appreciated!

RuedigerMoeller commented 7 years ago

as I don't have time somebody else needs to provide a custom serializer for this