With Xstream 1.4.14 Error : Cannot deserialize object with new readObject()/writeObject() for class XMLGregorianCalendarImpl

12 views
Skip to first unread message

Rahul Bhagat

unread,
Jul 5, 2023, 7:13:35 AM7/5/23
to XStream User
Hello,

I'm getting the following error while migrating from JDK 1.8 to JDK 11. 
Can someone please help/ advise?

Thanks,
Rahul.




com.thoughtworks.xstream.converters.ConversionException: Cannot deserialize object with new readObject()/writeObject() methods
---- Debugging information ----
message             : Cannot deserialize object with new readObject()/writeObject() methods
class               : com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl
required-type       : com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl
converter-type      : com.thoughtworks.xstream.converters.reflection.SerializableConverter
path                : /com.tpt.is.cdm.logistics.v1.DeliveryCDM/creationDate
line number         : 21
class[1]            : com.tpt.is.cdm.logistics.v1.DeliveryCDM
required-type[1]    : com.tpt.is.cdm.logistics.v1.DeliveryCDM
converter-type[1]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version             : 1.4.14
-------------------------------

Jörg Schaible

unread,
Jul 10, 2023, 5:13:32 PM7/10/23
to XStream User
Hi Rahul,

On Wednesday, 5. July 2023, 13:13:35 CEST Rahul Bhagat wrote:
> Hello,
>
> I'm getting the following error while migrating from JDK 1.8 to JDK 11.
> Can someone please help/ advise?

Unfortunately the internals of the class have been changed in the Java runtime
entirely. Since these classes are meant to be JDK internal, this is something
that can happen with each new Java version.

You may implement a custom converter for a XMLGregorianCalendar using the
javax,xml.datatype.DataFactory to create the instance (similar to XStream's
DurationConverter, that belongs into the same area).

However, your unmarshal method might have to handle also the existing XML
structure for this type. See e.g. XStream's AtomicIntegerConverter how this
can be achieved.

Cheers,
Jörg


Reply all
Reply to author
Forward
0 new messages