Skip to content

CLI does not work with Java9 #10445

@snicoll

Description

@snicoll

Running a simple script with the cli and Java 9 yield the following:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (jar:file:/Users/snicoll/tools/spring-boot-cli/spring-2.0.0.BUILD-SNAPSHOT/lib/spring-boot-cli-2.0.0.BUILD-SNAPSHOT.jar!/BOOT-INF/lib/groovy-2.5.0-beta-1.jar!/) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
	at org.springframework.boot.cli.app.SpringApplicationLauncher.launch(SpringApplicationLauncher.java:65)
	at org.springframework.boot.cli.command.run.SpringApplicationRunner$RunThread.run(SpringApplicationRunner.java:173)
Caused by: java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationContextInitializer : org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer
	at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:439)
	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:418)
	at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:409)
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:266)
	at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:247)
	... 6 more
Caused by: java.lang.NoClassDefFoundError: java/sql/SQLException
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:161)
	at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:435)
	... 10 more
Caused by: java.lang.ClassNotFoundException: java.sql.SQLException
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
	at org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader.findClass(ExtendedGroovyClassLoader.java:84)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:678)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:788)
	at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:776)
	... 12 more

I suspect ExtendedGroovyClassLoader to be the culprit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions