Search before asking
Version
Fory Scala artifact:
- org.apache.fory:fory-scala_2.13:1.6.1
- OpenJDK: 21.0.12
- Scala: 2.13.15
Affected versions verified:
- 1.3.0
- 1.4.0
- 1.5.0
- 1.6.0
- 1.6.1
The last version verified to load successfully on JDK 21 is 1.2.0.
JDK 21 supports class-file versions up to 65, but the published Scala artifact contains Java 25 bytecode with class-file version 69
Component(s)
Scala
Minimal reproduce step
Create an SBT project with:
ThisBuild / scalaVersion := "2.13.15"
libraryDependencies +=
"org.apache.fory" %% "fory-scala" % "1.6.1"
Then run:
import org.apache.fory.scala.ForyScala
object Reproducer extends App {
ForyScala.builder()
.withXlang(false)
.build()
}
Using JDK 21:
What did you expect to see?
fory-scala should initialize and run successfully on JDK 21 without UnsupportedClassVersionError, using bytecode compatible with the supported JDK versions
What did you see instead?
fory-scala fails during initialization on JDK 21 with UnsupportedClassVersionError because ScalaSerializers.class is compiled as Java 25 bytecode (class-file version 69), while JDK 21 supports up to version 65
Example:
Exception java.lang.UnsupportedClassVersionError: org/apache/fory/serializer/scala/ScalaSerializers has been compiled by a more recent version of the Java Runtime (class file version 69.0), this version of the Java Runtime only recognizes class file versions up to 65.0 [in thread "pool-1-thread-25"]
Root cause:
java.lang.ExceptionInInitializerError: Exception java.lang.UnsupportedClassVersionError: org/apache/fory/serializer/scala/ScalaSerializers has been compiled by a more recent version of the Java Runtime (class file version 69.0), this version of the Java Runtime only recognizes class file versions up to 65.0 [in thread "pool-1-thread-25"]
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(Unknown Source)
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(Unknown Source)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.fory.scala.ForyScala$.install(ForyScala.scala:30)
at org.apache.fory.Fory.register(Fory.java:232)
at org.apache.fory.config.ForyBuilder.install(ForyBuilder.java:656)
at org.apache.fory.config.ForyBuilder.newFory(ForyBuilder.java:786)
at org.apache.fory.config.ForyBuilder.lambda$factory$0(ForyBuilder.java:867)
at org.apache.fory.pool.ThreadPoolFory.lambda$new$0(ThreadPoolFory.java:64)
at org.apache.fory.pool.ThreadPoolFory.(ThreadPoolFory.java:69)
at org.apache.fory.config.ForyBuilder.buildThreadSafeForyPool(ForyBuilder.java:851)
Anything Else?
No response
Are you willing to submit a PR?
Search before asking
Version
Fory Scala artifact:
Affected versions verified:
The last version verified to load successfully on JDK 21 is 1.2.0.
JDK 21 supports class-file versions up to 65, but the published Scala artifact contains Java 25 bytecode with class-file version 69
Component(s)
Scala
Minimal reproduce step
Create an SBT project with:
Then run:
Using JDK 21:
What did you expect to see?
fory-scalashould initialize and run successfully on JDK 21 withoutUnsupportedClassVersionError, using bytecode compatible with the supported JDK versionsWhat did you see instead?
fory-scalafails during initialization on JDK 21 withUnsupportedClassVersionErrorbecauseScalaSerializers.classis compiled as Java 25 bytecode (class-file version 69), while JDK 21 supports up to version 65Example:
Anything Else?
No response
Are you willing to submit a PR?