Skip to content

jbang run <jarFile> ignores Add-Opens property in the MANIFEST.MF file #2438

@gsmet

Description

@gsmet

When running the following JBang command:

jbang --verbose --java 25 --fresh --repos 'quarkus-github-action=https://maven.pkg.github.com/quarkusio/update-quarkus-platform-action/' --repos 'mavencentral' io.quarkus.automation:update-quarkus-platform-action:999-SNAPSHOT

It seems that the Add-Opens elements present in the MANIFEST.MF of the jar are ignored.

Add-Opens: java.base/java.lang java.base/java.nio java.base/jdk.internal
.misc

These directives should prevent these problems:

Error: Exception in thread "vert.x-internal-blocking-1" java.lang.IllegalAccessError: module java.base does not open java.lang to unnamed module @205d38da; to use the thread-local-reset capability on Java 24 or later, use this JVM option: --add-opens java.base/java.lang=ALL-UNNAMED
at org.jboss.threads.JDKSpecific$ThreadAccess.(JDKSpecific.java:32)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:13)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1474)
Error: Exception in thread "executor-thread-1" java.lang.NoClassDefFoundError: Could not initialize class org.jboss.threads.JDKSpecific$ThreadAccess
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:13)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.IllegalAccessError: module java.base does not open java.lang to unnamed module @205d38da; to use the thread-local-reset capability on Java 24 or later, use this JVM option: --add-opens java.base/java.lang=ALL-UNNAMED [in thread "vert.x-internal-blocking-1"]
at org.jboss.threads.JDKSpecific$ThreadAccess.(JDKSpecific.java:32)
... 3 more

From what I can see, the jar is executed with the following command:

/usr/lib/jvm/temurin-25-jdk-amd64/bin/java -classpath /home/runner/.m2/repository/io/quarkus/automation/update-quarkus-platform-action/999-SNAPSHOT/update-quarkus-platform-action-999-SNAPSHOT.jar:/home/runner/.m2/repository/io/quarkus/automation/update-quarkus-platform-action/999-SNAPSHOT/update-quarkus-platform-action-999-SNAPSHOT.jar io.quarkus.runner.GeneratedMain

Which apparently does not honor what's in the MANIFEST.MF.

This issue is very similar to #2366 .

Also I'm not entirely sure why the same jar appears twice in the classpath? Probably something that should be fixed too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions