x-stream / xstream

Serialize Java objects to XML and back again.
http://x-stream.github.io
Other
749 stars 227 forks source link

xstream 1.4.4 moving from Oracle Java 1.8 to OpenJDK 1.8 #360

Closed vinoth78 closed 7 months ago

vinoth78 commented 7 months ago

Hello, how are you?

We updated from Oracle Java to OpenJDK recently. We pointed our application to OpenJDK JRE directory.

Could not parse xml com.thoughtworks.xstream.converters.ConversionException: Cannot construct.Config$Transitions as it does not have a no-args constructor : Cannot construct .Config$Transitions as it does not have a no-args constructor ---- Debugging information ---- message : Cannot construct as it does not have a no-args constructor cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException cause-message : Cannot construct as it does not have a no-args constructor class : .Config$Transitions required-type : .Config$Transitions converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter path : /config/transitions class[1] : .Config$Transitions version : null

But when we point back to the Oracle JRE version the application works fine.

Is this a problem with certain xstream version(s) or some OpenJDK JRE verion(s).

Is there a way to fix this without changing the code.

joehni commented 7 months ago

Well, when XStream 1.4.4 was released 11 years ago, all available Java 8 runtimes identified themselves as Version 1.8. The current OpenJDK Java 8 identifies itself as Version 8. Therefore XStream 1.4.4 has no clue about what this version is supporting and falls back to pure Java mode, which does is unable to create objects without default constructor. There is a reason, why XStream 1.4.20 exists...