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

Unable to run my project on Java 16 #260

Closed
Betalord opened this issue Aug 16, 2021 · 5 comments
Closed

Unable to run my project on Java 16 #260

Betalord opened this issue Aug 16, 2021 · 5 comments
Assignees
Labels

Comments

@Betalord
Copy link

Hi,
I just ported my project from older computer to a new one where I have JDK 16 installed, and my app crashes:

com.thoughtworks.xstream.converters.ConversionException: No converter available
---- Debugging information ----
message             : No converter available
type                : java.util.RegularEnumSet
converter           : com.thoughtworks.xstream.converters.enums.EnumSetConverter
message[1]          : Could not initialize class com.thoughtworks.xstream.converters.enums.EnumSetConverter$Reflections
converter[1]        : com.thoughtworks.xstream.converters.reflection.SerializableConverter
message[2]          : Unable to make private void java.util.EnumSet.readObject(java.io.ObjectInputStream) throws java.io.InvalidObjectException accessible: module java.base does not "opens java.util" to unnamed module @6aceb1a5
converter[2]        : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
message[3]          : Unable to make field private static final long java.util.EnumSet.serialVersionUID accessible: module java.base does not "opens java.util" to unnamed module @6aceb1a5
class               : com.betalord.sgx.core.Map
required-type       : com.betalord.sgx.core.Map
converter-type      : com.betalord.sgx.xstreamconverters.MapConverter
path                : /map/supportedPlayers
line number         : 6
version             : 1.4.13
-------------------------------

Any idea why? Was working well with some much older JDK on the other computer.

@joehni joehni self-assigned this Aug 16, 2021
@joehni
Copy link
Member

joehni commented Aug 16, 2021

You have to start the JVM of Java 16 with Option
--illegal-access=permit

@joehni joehni closed this as completed Aug 16, 2021
@Betalord
Copy link
Author

Betalord commented Aug 17, 2021

Could you elaborate on this solution a bit? What side effects does it have, why is it needed?

When using it, my Java says:
Java HotSpot(TM) 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
And a few lines later:
WARNING: All illegal access operations will be denied in a future release

@joehni
Copy link
Member

joehni commented Aug 17, 2021

XStream mimics Java serialization, which does a lot of stuff that is not possible with public API. Java 16 changed the preference for the --illegal-access option to allow this access.

@d98ama
Copy link

d98ama commented Aug 27, 2021

Are there any ways around this? It seems like this option is removed in Java 17:

OpenJDK 64-Bit Server VM warning: Ignoring option --illegal-access=permit; support was removed in 17.0

@Betalord
Copy link
Author

I managed to resolve it by passing these parameters:
java --illegal-access=permit --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED
which I found in another thread. However, this is a workaround, not a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants