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

Java 21 required for Spring 6.2.1 #34208

Closed
myronu opened this issue Jan 7, 2025 · 3 comments
Closed

Java 21 required for Spring 6.2.1 #34208

myronu opened this issue Jan 7, 2025 · 3 comments
Labels
for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid

Comments

@myronu
Copy link

myronu commented Jan 7, 2025

Spring Boot 3.4.1 documentation says it requires Java 17. However, when I upgraded from 2.7.12, Gradle is reporting Unsupported class file major version 65

Caused by: java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\.gradle\caches\jars-9\d8d29f440b7e01c66fd10a390db56541\spring-core-6.2.1.jar.
        at org.gradle.internal.UncheckedException.unchecked(UncheckedException.java:74)
        ... 167 more
Caused by: org.gradle.api.GradleException: Failed to create Jar file C:\TylerDev\.gradle\caches\jars-9\d8d29f440b7e01c66fd10a390db56541\spring-core-6.2.1.jar.
        at org.gradle.internal.classpath.ClasspathBuilder.jar(ClasspathBuilder.java:55)
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.instrument(InstrumentingClasspathFileTransformer.java:137)
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.transform(InstrumentingClasspathFileTransformer.java:132)
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.transform(InstrumentingClasspathFileTransformer.java:96)
        at org.gradle.internal.classpath.DefaultCachedClasspathTransformer.transformFile(DefaultCachedClasspathTransformer.java:193)
        at org.gradle.internal.classpath.DefaultCachedClasspathTransformer.lambda$cachedFile$6(DefaultCachedClasspathTransformer.java:186)
        at org.gradle.internal.UncheckedException.unchecked(UncheckedException.java:74)
        at org.gradle.internal.classpath.DefaultCachedClasspathTransformer.lambda$transformAll$9(DefaultCachedClasspathTransformer.java:233)
        ... 2 more
Caused by: java.io.IOException: Failed to process the entry 'META-INF/versions/21/org/springframework/core/task/VirtualThreadDelegate.class' from 'C:\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\6.2.1\f42e6b51d9c0c2fcf95df9e5848470d173adc9af\spring-core-6.2.1.jar'
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.lambda$visitEntries$1(InstrumentingClasspathFileTransformer.java:161)
        at org.gradle.internal.classpath.ClasspathWalker.visitJarContents(ClasspathWalker.java:91)
        at org.gradle.internal.classpath.ClasspathWalker.visit(ClasspathWalker.java:55)
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.visitEntries(InstrumentingClasspathFileTransformer.java:148)
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.lambda$instrument$0(InstrumentingClasspathFileTransformer.java:139)
        at org.gradle.internal.classpath.ClasspathBuilder.buildJar(ClasspathBuilder.java:66)
        at org.gradle.internal.classpath.ClasspathBuilder.jar(ClasspathBuilder.java:53)
        ... 9 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:199)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
        at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.lambda$visitEntries$1(InstrumentingClasspathFileTransformer.java:151)
        ... 15 more
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 7, 2025
@bclozel
Copy link
Member

bclozel commented Jan 7, 2025

Spring Framework is publishing a multi-release JAR to ship Java 21 virtual thread support.
This is not a Spring Framework issue, but a Gradle issue that has been fixed already. Please upgrade your Gradle version.

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2025
@bclozel bclozel added status: invalid An issue that we don't feel is valid for: external-project Needs a fix in external project and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 7, 2025
@myronu
Copy link
Author

myronu commented Jan 7, 2025

For some reason, it works with Spring Boot 3.3.7, but not 3.4.1, so I will use that until we can upgrade gradle

@bclozel
Copy link
Member

bclozel commented Jan 8, 2025

Spring Boot 3.4 requires Gradle 7.6.4+ or 8.3+; this might explain the behavior you're seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants