Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xstream1.4.11 need jdk 8? #133

Closed
cndoublehero opened this issue Oct 25, 2018 · 4 comments

Comments

@cndoublehero
Copy link

commented Oct 25, 2018

hi,guys

xstream 1.4.11 is been release lately, after i upgrate in my project, i got a exception. After i dig in the source code. I found that Base64JavaUtilCodec class use java.util.Base64 package. And java.util.Base64 package is been import from jdk1.8.
Is it mean that xstream 1.4.11 donot support jdk 6、7 any more?

@joehni joehni self-assigned this Oct 25, 2018
@joehni

This comment has been minimized.

Copy link
Member

commented Oct 25, 2018

It does. It runs even on Java 1.4. The appropriate implementation for base64 is selected based on the current Java runtime. However, the xstream jar contains multiple classes compiled for Java 8 only, but that is nothing new.

The question is, why you do get an exception? What is your envrornment and which xstream library are you using?

@joehni joehni added the question label Oct 25, 2018
@cndoublehero

This comment has been minimized.

Copy link
Author

commented Oct 26, 2018

My jdk version is jdk6 and xstream version is 1.4.11, and I write simple code like this :
XStream xStream = new XStream();
Run it and got an exception stack:
Exception in thread "main" java.lang.NoClassDefFoundError: java/util/Base64$Encoder
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.thoughtworks.xstream.core.JVM.(JVM.java:187)
at com.thoughtworks.xstream.core.util.CompositeClassLoader.(CompositeClassLoader.java:56)
at com.thoughtworks.xstream.XStream.(XStream.java:430)
at com.thoughtworks.xstream.XStream.(XStream.java:369)
at ATest.main(ATest.java:5)
Caused by: java.lang.ClassNotFoundException: java.util.Base64$Encoder
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 10 more

The code of JVM class in line 423- 429 like this :
if(base64Class != null) {
try {
base64 = (StringCodec)base64Class.newInstance();
} catch (Exception var9) {
;
}
}

unfortunately this time the progrom throw an error and cannot catch the error.

@joehni joehni added bug and removed question labels Oct 26, 2018
@joehni joehni added this to the 1.4.x milestone Oct 26, 2018
@joehni

This comment has been minimized.

Copy link
Member

commented Oct 26, 2018

Ouch. The difference to the CI tests is, that those compile and run with the target JDK. Nevertheless this is very annoying, I'll have to cut 1.4.12. However, I'll be offline for a week now, you have to wait for mid of November...

joehni added a commit that referenced this issue Oct 26, 2018
@joehni joehni closed this in 6f03bea Oct 26, 2018
@joehni joehni modified the milestones: 1.4.x, 1.4.11 Oct 26, 2018
@joehni

This comment has been minimized.

Copy link
Member

commented Oct 26, 2018

XStream 1.4.11.1 will hit central repository soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.