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

Unable to build with Java 16 #7901

Closed
erichwang opened this issue May 12, 2021 · 4 comments · Fixed by #7932
Closed

Unable to build with Java 16 #7901

erichwang opened this issue May 12, 2021 · 4 comments · Fixed by #7932

Comments

@erichwang
Copy link
Contributor

When using Java 16 to build the project, we quickly get the following error:

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
	at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
	at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:50)
Caused by: java.lang.ExceptionInInitializerError
	at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:807)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:574)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:496)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:465)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:411)
	at com.thoughtworks.xstream.XStream.<init>(XStream.java:350)
	at ca.vanzyl.provisio.model.io.RuntimeReader.<init>(RuntimeReader.java:61)
	at ca.vanzyl.maven.plugins.provisio.Provisio.parseDescriptor(Provisio.java:97)
	at ca.vanzyl.maven.plugins.provisio.Provisio.findDescriptorsInFileSystem(Provisio.java:68)
	at ca.vanzyl.maven.plugins.provisio.ProvisioningLifecycleParticipant.gleanDependenciesFromExternalResource(ProvisioningLifecycleParticipant.java:115)
	at ca.vanzyl.maven.plugins.provisio.ProvisioningLifecycleParticipant.afterProjectsRead(ProvisioningLifecycleParticipant.java:69)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:264)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
	... 7 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @6b0615ae
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
	at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
	at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:39)
	at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
	... 32 more
@amitds1997
Copy link
Contributor

The issue is likely because of the dependency of maven plugins on xstream which has not been updated.
xstream fixed this issue in 1.4.13 (source)

However, we are at 1.4.7.

$ ./mvnw dependency:tree
[INFO] Scanning for projects...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/Users/amitsingh/.m2/repository/com/thoughtworks/xstream/xstream/1.4.7/xstream-1.4.7.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
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

My guess is we have a maven plugin which is using an older version of xstream.

@hashhar
Copy link
Member

hashhar commented May 15, 2021

It's being pulled in from provisio-model which we use for packaging. It's updated upstream in jvanzyl/provisio@d70e158 but there hasn't been a new release since.

@nineinchnick might know if there's a release coming since he got something merged-in upstream.

@nineinchnick
Copy link
Member

It's being pulled in from provisio-model which we use for packaging. It's updated upstream in jvanzyl/provisio@d70e158 but there hasn't been a new release since.

@nineinchnick might know if there's a release coming since he got something merged-in upstream.

There was a new release two days ago.

@electrum
Copy link
Member

Updated the CI to use JDK 16 in #7952

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

5 participants