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

Fehlermeldung beim Start des openbook Cleaners #38

Closed
harrykl opened this issue Oct 25, 2021 · 3 comments
Closed

Fehlermeldung beim Start des openbook Cleaners #38

harrykl opened this issue Oct 25, 2021 · 3 comments

Comments

@harrykl
Copy link

harrykl commented Oct 25, 2021

Hallo,

ich bekomme beim Aufruf des Cleaners folgende Fehlermeldung
java -jar openbook_cleaner-1.2.0-SNAPSHOT.jar -d . all Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at com.simontuffs.onejar.Boot.run(Boot.java:306) at com.simontuffs.onejar.Boot.main(Boot.java:159) Caused by: java.lang.ExceptionInInitializerError at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:820) at com.thoughtworks.xstream.XStream.<init>(XStream.java:574) at com.thoughtworks.xstream.XStream.<init>(XStream.java:496) at com.thoughtworks.xstream.XStream.<init>(XStream.java:465) at com.thoughtworks.xstream.XStream.<init>(XStream.java:411) at com.thoughtworks.xstream.XStream.<init>(XStream.java:378) at de.scrum_master.galileo.Book.<clinit>(Book.java:23) at de.scrum_master.galileo.Options.parse(Options.java:46) at de.scrum_master.galileo.OpenbookCleaner.processArgs(OpenbookCleaner.java:36) at de.scrum_master.galileo.OpenbookCleaner.main_aroundBody0(OpenbookCleaner.java:29) at de.scrum_master.galileo.OpenbookCleaner.main_aroundBody1$advice(OpenbookCleaner.java:12) at de.scrum_master.galileo.OpenbookCleaner.main(OpenbookCleaner.java:1) ... 6 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @eec5a4a at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177) at java.base/java.lang.reflect.Field.setAccessible(Field.java:171) at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39) at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50) ... 18 more

@kriegaex
Copy link
Owner

This project uses XStream 1.4.8, but even upgrading to XStream 1.4.18 does not completely solve the problem of the library being incompatible with Java 16 and 17. This is well known and due to the fact that Xstream uses internal Java APIs which by default are blocked since the JDK moved on to further restricting deprecated or internal API access. Currently, you have two options:

  1. Build and run on a Java version <16.
  2. Run the cleaner with JVM options --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED in order to help XStream access the APIs it needs.

@kriegaex
Copy link
Owner

kriegaex commented Oct 25, 2021

The best I could do for you is upgrade to 1.4.18, after I found out how to avoid an XML parsing error due to certain security-related changes in XStream usage. See commit 5a39042.

Now, on JDK 16+ you only need to add --add-opens java.base/java.util=ALL-UNNAMED, but XStream still does not work completely without opening that package, unfortunately.

See x-stream/xstream#262.

@harrykl
Copy link
Author

harrykl commented Oct 25, 2021

This project uses XStream 1.4.8, but even upgrading to XStream 1.4.18 does not completely solve the problem of the library being incompatible with Java 16 and 17. This is well known and due to the fact that Xstream uses internal Java APIs which by default are blocked since the JDK moved on to further restricting deprecated or internal API access. Currently, you have two options:

  1. Build and run on a Java version <16.
  2. Run the cleaner with JVM options --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED in order to help XStream access the APIs it needs.

Thank You. Works for me!!!!

@harrykl harrykl closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants