bnd icon indicating copy to clipboard operation
bnd copied to clipboard

reporter: Dependencies fail on Java 16 without --add-opens

Open bjhargrave opened this issue 3 years ago • 8 comments

The dependencies in the reporter seem to need updating to versions which don't exhibit reflective errors on Java 16.

[INFO] [INFO] --- bnd-reporter-maven-plugin:5.4.0-SNAPSHOT:readme (default-cli) @ reporter-test ---
[INFO] [INFO] Generating reports...
[INFO] [ERROR] Error   : Exception: java.lang.RuntimeException: Error creating extended parser class: Could not determine whether class 'org.jtwig.parser.parboiled.base.BooleanParser$$parboiled' has already been loaded
[INFO]  at org.parboiled.Parboiled.createParser(Parboiled.java:58)
[INFO]  at org.jtwig.parser.parboiled.ParserContext.instance(ParserContext.java:31)
[INFO]  at org.jtwig.parser.parboiled.ParboiledJtwigParser.parse(ParboiledJtwigParser.java:37)
[INFO]  at org.jtwig.parser.cache.InMemoryConcurrentPersistentTemplateCache.get(InMemoryConcurrentPersistentTemplateCache.java:39)
[INFO]  at org.jtwig.parser.CachedJtwigParser.parse(CachedJtwigParser.java:19)
[INFO]  at org.jtwig.JtwigTemplate.render(JtwigTemplate.java:98)
[INFO]  at org.jtwig.JtwigTemplate.render(JtwigTemplate.java:80)
[INFO]  at biz.aQute.bnd.reporter.plugins.transformer.JtwigTransformerPlugin.transform(JtwigTransformerPlugin.java:79)
[INFO]  at biz.aQute.bnd.reporter.exporter.ReportExporter.transform(ReportExporter.java:206)
[INFO]  at biz.aQute.bnd.reporter.exporter.ReportExporter.lambda$exportReportsOf$1(ReportExporter.java:79)
[INFO]  at java.base/java.util.HashMap$EntrySet.forEach(HashMap.java:1130)
[INFO]  at biz.aQute.bnd.reporter.exporter.ReportExporter.exportReportsOf(ReportExporter.java:70)
[INFO]  at aQute.bnd.maven.reporter.plugin.ReadmeMojo.execute(ReadmeMojo.java:89)
[INFO]  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[INFO]  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[INFO]  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[INFO]  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[INFO]  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[INFO]  at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[INFO]  at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[INFO]  at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[INFO]  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[INFO]  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[INFO]  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[INFO]  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[INFO]  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[INFO]  at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[INFO]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[INFO]  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO]  at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[INFO]  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[INFO]  at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[INFO]  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[INFO]  at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[INFO] Caused by: java.lang.RuntimeException: Could not determine whether class 'org.jtwig.parser.parboiled.base.BooleanParser$$parboiled' has already been loaded
[INFO]  at org.parboiled.transform.AsmUtils.findLoadedClass(AsmUtils.java:213)
[INFO]  at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:35)
[INFO]  at org.parboiled.Parboiled.createParser(Parboiled.java:54)
[INFO]  ... 34 more
[INFO] Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) accessible: module java.base does not "opens java.lang" to unnamed module @de88ac6
[INFO]  at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
[INFO]  at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
[INFO]  at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
[INFO]  at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
[INFO]  at org.parboiled.transform.AsmUtils.findLoadedClass(AsmUtils.java:206)
[INFO]  ... 36 more
[INFO] 
[INFO] [ERROR] Error   : Failed to transform the report

bjhargrave avatar Mar 23 '21 15:03 bjhargrave

I worked around this with https://github.com/bndtools/bnd/commit/148df0610728e949557d65baa80c412d85ae85d0 but we should update to use dependencies which don't exhibit this issue.

bjhargrave avatar Mar 23 '21 15:03 bjhargrave

Is there something special to build bnd with Java 16. After many attempts I still get errors from gradle...

cdelg avatar Apr 01 '21 20:04 cdelg

You will need to locally use the Gradle 7.0 RC build to run the build on Java 16. Only Gradle 7 support running on Java 16.

https://docs.gradle.org/7.0-rc-1/release-notes.html#upgrade-instructions

bjhargrave avatar Apr 01 '21 20:04 bjhargrave

Sorry, can you tell me the steps to reproduce the error.

I think Java and gradle versions are fine:

$ ./gradlew -v
------------------------------------------------------------
Gradle 7.0-rc-1
------------------------------------------------------------

Build time:   2021-03-23 01:02:30 UTC
Revision:     f5bf7ade373b74058e49f07749083b4c3075549a

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          16 (Red Hat, Inc. 16+36)
OS:           Linux 5.11.9-200.fc33.x86_64 amd64

Then I run this:

$ ./gradlew maven:deploy

but I see no issue.

I also tried to directly run mvn commands, to build the entire repository but I still don't get the error.

cdelg avatar Apr 03 '21 08:04 cdelg

Sorry, can you tell me the steps to reproduce the error.

In the second comment, I said:

I worked around this with 148df06 but we should update to use dependencies which don't exhibit this issue.

So you would need to revert that commit to remove the workaround and expose the error.

bjhargrave avatar Apr 04 '21 14:04 bjhargrave

So you would need to revert that commit to remove the workaround and expose the error.

Yes indeed, that was the case, I finally get the error. I tried to update asm and parboiled but no success :( JTwig project is dead now, I will try to find a replacement...

cdelg avatar Apr 04 '21 16:04 cdelg

FYI, the Bnd build is now updated to use gradlew 7.0.

bjhargrave avatar Apr 13 '21 15:04 bjhargrave

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

github-actions[bot] avatar Sep 18 '22 03:09 github-actions[bot]

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Bnd/Bndtools or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

github-actions[bot] avatar Oct 10 '22 03:10 github-actions[bot]