I have been struggling with a problem about Kryo. I have a client server architecture and sending message via JMS using Kryo. In one of my response class I have a class having javax.xml.datatype.Duration class as attribute. There is no chance for me to change it since it is in an interface of two software.
In the error stack, it gives this class having the problem: com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl. I do not use it in anywhere in my code. I have written some code to say Kryo to how to serialize javax.xml.datatype.Duration class like this:
public Duration read(kryoi input, entryClass){
return DataTypeFactory.newInstance().newDuration((String)kryo.readClassAndObject(input));
}
public void write(kryo, out, entryclass){
kryo.writeClassAndObject(out, entryClass.toString());
}
This does not solve the problem. I would like to achieve com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl class object to write Kryo serializer for it. However I have no access for the class. How could I solve it?
Thanks in advance
Implement a
DurationSerializeras:Then register it as
Serializerfor theDurationimplementation of your JAXP library as: