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

5.0.0 cannot be run with Java 17 (DefaultSecurityConfig.groovy - Unsupported class file major version 61) #737

Open
mhuebner opened this issue Mar 28, 2022 · 2 comments

Comments

@mhuebner
Copy link

Expected Behavior

We are able to run Grails 5 apps with JDK 17 (tomcat:9.0.60-jdk17-corretto) but since using grails-spring-security-core 5.0.0 Java throws an error:

BUG! exception in phase 'semantic analysis' in source unit 'jar:file:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/spring-security-core-5.0.0-plain.jar!/DefaultSecurityConfig.groovy' Unsupported class file major version 61

Grails 5.1.4 runs with JDK 17 but the spring security plugin might have been build with an old JDK (or DefaultSecurityConfig was never touched).

Actual Behaviour

No response

Steps To Reproduce

No response

Environment Information

Docker-Image: tomcat:9.0.60-jdk17-corretto

Example Application

No response

Version

5.1.4

@puneetbehl
Copy link
Contributor

Thank you for taking time to report this issue. I think it may be that the plugin is using some specific Groovy features which are incompatible with Java 17. However, we will investigate further to see what is the problem.

Meanwhile, I would appreciate if you could share a sample application or steps to reproduce the problem.

@mhuebner
Copy link
Author

mhuebner commented Jun 1, 2022

@puneetbehl Thank you for looking into this.

I built an example app. You can follow these steps to reproduce the issue:

[requirements: JAVA_HOME set to 11.0.14.10.1-amzn via sdk (https://sdkman.io/) or any other JDK 11 + docker (I am using Docker version 20.10.12)]

  1. Clone the repo: git clone [email protected]:mhuebner/grails-spring-security-737.git
  2. CD in to the working copy: cd grails-spring-security-737
  3. Run docker task to build the war file and copy it into the docker image: ./gradlew docker
  4. Verify the image was built correctly: docker images should show gssi737:latest
  5. Run the app (tomcat + jdk17 + grails app via war): docker run -it gssi737:latest

An exception is thrown when tomcat ist starting up:

2022-06-01 07:28:01.405 ERROR --- [           main] o.s.boot.SpringApplication               : Application run failed

org.codehaus.groovy.GroovyBugError: BUG! exception in phase 'semantic analysis' in source unit 'jar:file:/usr/local/tomcat/webapps/ROOT/WEB-INF/lib/spring-security-core-5.0.0-plain.jar!/DefaultSecurityConfig.groovy' Unsupported class file major version 61
	at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:905)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
	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 groovy.lang.GroovyClassLoader.recompile(GroovyClassLoader.java:959)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:910)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:979)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:967)
	at grails.plugin.springsecurity.SpringSecurityUtils.mergeConfig(SpringSecurityUtils.groovy:635)
	at grails.plugin.springsecurity.SpringSecurityUtils.reloadSecurityConfig(SpringSecurityUtils.groovy:264)
	at grails.plugin.springsecurity.SpringSecurityUtils.getSecurityConfig(SpringSecurityUtils.groovy:233)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
...

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

2 participants