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

JDK 17 Support / Gradle 7.3.0 #12152

Closed
codeconsole opened this issue Oct 25, 2021 · 16 comments
Closed

JDK 17 Support / Gradle 7.3.0 #12152

codeconsole opened this issue Oct 25, 2021 · 16 comments

Comments

@codeconsole
Copy link
Contributor

codeconsole commented Oct 25, 2021

Gradle 7.3.0 will soon be released (Currently RC3) and will support JDK 17

JDK is the new LTS and was released in September.

JDK 17 requires asm 9.1 and Groovy 3.0.8 is the first version to support it.

Fortunately, Grails 5.0.0 introduced groovyVersion in gradle.properties and can be updated to Groovy 3.0.8+, so now is the time to start planning for JDK 17 support once Gradle 7.3.0 is released.

Current Gradle Computability Matrix

@Taack
Copy link

Taack commented Oct 26, 2021

Grails 5.0.0 depends on Groovy 3.0.7, not 3.0.8.

It would be great to wait for Groovy 3.0.10 when it is released. We have runtime issues with Groovy 3.0.8 and 3.0.9..

@arixmkii
Copy link

For us Grails 5.0.0 works with Gradle 7.2 and JDK 17 (I believe we have some lucky combination of plugins, which doesn't cause issues). We use gradle resolutionStrategy to force groovy 3.0.9 in our app, though.

But release of 5.0.1 with gradle 7.3 and groovy 3.0.9 out of the box would be highly appreciated.

@codeconsole
Copy link
Contributor Author

@Taack yeah, I realized I had already updated the groovy version prior to 5.0.0 being released. I am getting runtime issues as well with my production app. Are you experiencing something similar and do you expect it to be resolved with Groovy 3.0.10?

I have successfully run and built an app using Gradle 7.3 rc2 / Groovy 3.0.8, but in my main production app i have an issue just running my main app with JDK 17 even if it is built with JDK 11. Running the same jar with JDK 11 works find.

Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is groovy.lang.MissingMethodException: No signature of method: java.lang.Object.clone() is applicable for argument types: () values: []
Possible solutions: collect(), collect(groovy.lang.Closure), collect(java.util.Collection, groovy.lang.Closure), find(), any(), any(groovy.lang.Closure)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:389)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:134)

@codeconsole
Copy link
Contributor Author

codeconsole commented Oct 26, 2021

I diagnosed my issue and found it is do to having multiple dataSources configured in application.yml

Example App

I have created the following issue that needs to be resolved in order to support JDK 17
grails/gorm-hibernate5#402

@Taack
Copy link

Taack commented Oct 27, 2021

@codeconsole I reported one issue GROOVY-10320, it will be resolved with Groovy 3.0.10. I do have another one against Groovy 3.0.8 which cause me headheck, but has been resolved with Groovy 3.0.9 (so I do not report the later).

@codeconsole
Copy link
Contributor Author

codeconsole commented Feb 5, 2022

This will probably depend on Groovy 4.x support
#12373

@codeconsole
Copy link
Contributor Author

I can confirm Grails 5.1.7 working with JDK 17 using Groovy 3.0.11-SNAPSHOT
I had to use gradle bootRun

However, the grails cli does not work.

% grails
| Error Failed to compile CreateFunctionalTest.groovy: startup failed:
General error during conversion: Unsupported class file major version 61

java.lang.IllegalArgumentException: Unsupported class file major version 61
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:189)
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:170)
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:156)
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:277)
	at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
	at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
	at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)
	at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:169)
	at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:125)
	at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:57)
	at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:44)
	at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:79)
	at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:70)
	at org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:49)
	at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lambda$createMethodNode$1(DecompiledClassNode.java:230)
	at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.createMethodNode(DecompiledClassNode.java:236)
	at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:203)
	at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getDeclaredMethods(DecompiledClassNode.java:122)
	at org.codehaus.groovy.ast.ClassNode.tryFindPossibleMethod(ClassNode.java:1283)
	at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:251)
	at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:133)
	at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:108)
	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:111)
	at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:66)
	at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:108)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:101)
	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1089)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
	at org.codehaus.groovy.control.CompilationUnit.lambda$addPhaseOperations$3(CompilationUnit.java:209)
	at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:942)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:671)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:635)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
	at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:314)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:288)
	at org.grails.cli.profile.commands.factory.GroovyScriptCommandFactory.readCommandFile(GroovyScriptCommandFactory.groovy:50)
	at org.grails.cli.profile.commands.factory.GroovyScriptCommandFactory.readCommandFile(GroovyScriptCommandFactory.groovy)
	at org.grails.cli.profile.commands.factory.ResourceResolvingCommandFactory.findCommands(ResourceResolvingCommandFactory.groovy:44)
	at org.grails.cli.profile.commands.CommandRegistry.findCommands(CommandRegistry.groovy:86)
	at org.grails.cli.profile.commands.CommandRegistry.findCommands(CommandRegistry.groovy)
	at org.grails.cli.profile.AbstractProfile.getCommands(AbstractProfile.groovy:432)
	at org.grails.cli.profile.repository.AbstractJarProfileRepository$JarProfile.getCommands(AbstractJarProfileRepository.groovy:130)
	at org.grails.cli.profile.AbstractProfile.getCompleters(AbstractProfile.groovy:362)
	at org.grails.cli.GrailsCli.setupCompleters(GrailsCli.groovy:420)
	at org.grails.cli.GrailsCli.handleInteractiveMode(GrailsCli.groovy:402)
	at org.grails.cli.GrailsCli.execute(GrailsCli.groovy:273)
	at org.grails.cli.GrailsCli.main(GrailsCli.groovy:159)

1 error
 (Use --stacktrace to see the full trace)
| Error Error occurred running Grails CLI: Cannot invoke "org.grails.cli.profile.commands.script.GroovyScriptCommand.setProfile(org.grails.cli.profile.Profile)" because "data" is null (Use --stacktrace to see the full trace)

@codeconsole
Copy link
Contributor Author

The only JDK 17 issues that seem to be remaining are grails cli issues.

% grails -v
| Grails Version: 5.1.8
| JVM Version: 17.0.3
% grails create-app grails4bugs
| Application created at /grails4bugs
% cd grails4bugs
| Resolving Dependencies. Please wait...

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE SUCCESSFUL in 4s
| Error Failed to compile CreateFunctionalTest.groovy: startup failed:
General error during conversion: Unsupported class file major version 61

java.lang.IllegalArgumentException: Unsupported class file major version 61
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:189)
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:170)
	at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:156)

@codeconsole
Copy link
Contributor Author

FYI JDK 17 is version 61 so the CLI is not supporting compiling itself

@codeconsole
Copy link
Contributor Author

This seems like an issue being enforced by the framework

grails/grails-spring-security-core#767
grails/grails-spring-security-ui#127
grails/grails-spring-security-core#737

@fernando88to
Copy link

I ran grails 5.2.2 with jdk 17 by ./gradlew bootRun and it worked normally.

@codeconsole
Copy link
Contributor Author

I can confirm JDK 17 is now working

@agre1981
Copy link

Hello, can we announce official support for java 17?
Now documentation says: "We have tested most Grails projects up to JDK 14."
https://docs.grails.org/5.2.x/guide/single.html#whatsNew

@DJViking
Copy link

DJViking commented Feb 1, 2023

Has the fix for JDK17 been released into the latest Grails 5.2.5 release?

When using Grails 5.2.5 with JDK17, I am unable to build.
It did not help changing the Gradle Wrapper from 7.2 to 7.3, or 7.6

./gradlew bootRun and grails run-app Works fine, but ./gradlew build fails like this.

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':configureChromeDriverBinary'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
Caused by: java.lang.IllegalAccessException: module jdk.proxy4 does not open jdk.proxy4 to unnamed module @32464a14
        ... 134 more

This comes from a project created with grails create-app helloworld.

@agre1981
Copy link

agre1981 commented Feb 3, 2023

Yes, you are right, build doesn't work in 5.2.5, at least for me )

Looks this relates to the issue: erdi/webdriver-binaries-gradle-plugin#30

Caused by: java.lang.IllegalAccessException: module jdk.proxy4 does not open jdk.proxy4 to unnamed module @20e2cbe0
	... 139 more

@agre1981
Copy link

agre1981 commented Feb 3, 2023

Adding this to dependencies fixes the issue

buildscript {
    dependencies {
        classpath "org.ysb33r.gradle:grolifant50:2.0.0-alpha.6"    
    }

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

6 participants