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

JDK16 compatibility issues #3284

Open
schrepfler opened this issue Jul 26, 2021 · 5 comments
Open

JDK16 compatibility issues #3284

schrepfler opened this issue Jul 26, 2021 · 5 comments

Comments

@schrepfler
Copy link

Are you looking for help?

Checking if it's possible to migrate development on JDK16

Lagom Version (1.2.x / 1.3.x / etc)

1.6.5

API (Scala / Java / Neither / Both)

Java/maven

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacOS Big Sur

JDK (Oracle 1.8.0_112, OpenJDK 1.8.x, Azul Zing)

16.0.1.hs-adpt

Library Dependencies

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. run mvn clean install

Actual Behavior

Project passes but stops when integration suite kicks off.

  • Issue when starting Kafka
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @654b5005
	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.Method.checkCanSetAccessible(Method.java:199)
	at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
	at javassist.util.proxy.SecurityActions.setAccessible(SecurityActions.java:159)
	at javassist.util.proxy.DefineClassHelper$JavaOther.defineClass(DefineClassHelper.java:213)
	at javassist.util.proxy.DefineClassHelper$Java11.defineClass(DefineClassHelper.java:52)
	at javassist.util.proxy.DefineClassHelper.toClass(DefineClassHelper.java:263)
	at javassist.ClassPool.toClass(ClassPool.java:1232)
	at javassist.ClassPool.toClass(ClassPool.java:1090)
	at javassist.ClassPool.toClass(ClassPool.java:1048)
	at javassist.CtClass.toClass(CtClass.java:1290)
	at org.apache.curator.test.ByteCodeRewrite.fixMethods(ByteCodeRewrite.java:95)
	at org.apache.curator.test.ByteCodeRewrite.<clinit>(ByteCodeRewrite.java:50)
	at org.apache.curator.test.TestingServer.<clinit>(TestingServer.java:33)
	at com.lightbend.lagom.internal.kafka.KafkaLocalServer$ZooKeeperLocalServer.start(KafkaLocalServer.scala:177)
	at com.lightbend.lagom.internal.kafka.KafkaLocalServer.start(KafkaLocalServer.scala:36)
	at com.lightbend.lagom.internal.kafka.KafkaLauncher$.main(KafkaLauncher.scala:49)
	at com.lightbend.lagom.internal.kafka.KafkaLauncher.main(KafkaLauncher.scala)
  • Issue when starting Cassandra
Exception (java.lang.AssertionError) encountered during startup: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @654b5005
java.lang.AssertionError: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @654b5005
	at org.apache.cassandra.utils.FBUtilities.getProtectedField(FBUtilities.java:608)
	at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:80)
	at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:196)
	at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:602)
	at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:691)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @654b5005
	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 org.apache.cassandra.utils.FBUtilities.getProtectedField(FBUtilities.java:603)
	... 4 more
07/26 13:41:54 ERROR[main] o.a.c.s.CassandraDaemon - Exception encountered during startup
java.lang.AssertionError: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @654b5005
	at org.apache.cassandra.utils.FBUtilities.getProtectedField(FBUtilities.java:608) ~[cassandra-bundle.jar:1.0.0-M0+46-b373604e]
	at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:80) ~[cassandra-bundle.jar:1.0.0-M0+46-b373604e]
	at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:196) ~[cassandra-bundle.jar:1.0.0-M0+46-b373604e]
	at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:602) ~[cassandra-bundle.jar:1.0.0-M0+46-b373604e]
	at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:691) ~[cassandra-bundle.jar:1.0.0-M0+46-b373604e]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @654b5005
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357) ~[na:na]
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177) ~[na:na]
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:171) ~[na:na]
	at org.apache.cassandra.utils.FBUtilities.getProtectedField(FBUtilities.java:603) ~[cassandra-bundle.jar:1.0.0-M0+46-b373604e]
	... 4 common frames omitted
  • Issue starting Service Locator
[ERROR] Failed to execute goal com.lightbend.lagom:lagom-maven-plugin:1.6.5:startAll (default) on project integration-tests: Execution lagom-internal-request of goal com.lightbend.lagom:lagom-maven-plugin:1.6.5:startServiceLocator failed: Failed to start embedded Service Locator or Service Gateway. Hint: Are ports 9008 or 9000 already in use?: java.lang.IllegalStateException: Unable to load cache item: ExceptionInInitializerError: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @5d604f00 -> [Help 1]
@randers-bit
Copy link

I know that cassandra just "recently" supports java 11 in new 4.x version (currently 4.0-RC2). I think lagom uses in development mode cassandra 3.x which is not working on jdk 11 and should not work on 16 either

@schrepfler
Copy link
Author

I know that cassandra just "recently" supports java 11 in new 4.x version (currently 4.0-RC2). I think lagom uses in development mode cassandra 3.x which is not working on jdk 11 and should not work on 16 either

That's great observation, I wasn't sure if it's vanilla Cassandra or embedded C* or embedded Kafka. There was also conversation in extracting this part of the maven lifecycle to use testcontainers.

@ignasi35
Copy link
Contributor

I think lagom uses in development mode cassandra 3.x which is not working on jdk 11 and should not work on 16 either

A lagom build runs tests in both JDK8 and JDK11. A user with JDK11 can develop lagom services and user lagom's runAll to start them and run the embedded Cassandra.

@ignasi35
Copy link
Contributor

JDK 16 is not LTS so it's not on the roadmap to support it.

Supporting JDK17, OTOH is another matter. At the moment, lagom doesn't support JDK17 because play doesn't support it either.

When that happens, the most likely suggestion would be to not use the embedded Cassandra in dev mode ( aka runAll) and, instead, run Cassandra manually on a container in the developer machine.

@gabizou
Copy link
Contributor

gabizou commented Aug 28, 2021

For what it’s worth, I’ve found that it’s the Cassandra driver using good old reflection that newer Java versions no longer support unless you explicitly enable via —illegal-access=permit as a jvm flag in maven. I’ve had this work in development, but not tested in a full production environment (yet).

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

No branches or pull requests

4 participants