Skip to content

[GR-60766] [Native Image] Pico CLI native app fails to run on Graal 23 #10390

Open
@Hakky54

Description

Describe the Issue

I am using Pico CLI alongside with Graal to create a native image for Certificate Ripper. I noticed that the Pico CLI app is working on Graal 22 but not on Graal 23 anymore when creating/running a native image.

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

openjdk 23.0.1 2024-10-15
OpenJDK Runtime Environment GraalVM CE 23.0.1+11.1 (build 23.0.1+11-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 23.0.1+11.1 (build 23.0.1+11-jvmci-b01, mixed mode, sharing)

Operating System and Version

Mac OS X 14.5

Troubleshooting Confirmation

Run Command

./target/crip

Expected Behavior

No runtime exception

Actual Behavior

Exception in thread "main" picocli.CommandLine$InitializationException: Cannot instantiate nl.altindag.crip.command.VersionProvider: the class has no constructor
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5689)
        at picocli.CommandLine$DefaultFactory.createVersionProvider(CommandLine.java:5675)
        at picocli.CommandLine$Model$CommandSpec.updateVersionProvider(CommandLine.java:7494)
        at picocli.CommandLine$Model$CommandSpec.updateCommandAttributes(CommandLine.java:7459)
        at picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:11845)
        at picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:6392)
        at picocli.CommandLine.<init>(CommandLine.java:230)
        at picocli.CommandLine.<init>(CommandLine.java:224)
        at picocli.CommandLine.<init>(CommandLine.java:199)
        at nl.altindag.crip.App.main(App.java:25)
        at java.base@23.0.1/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: java.lang.NoSuchMethodException: nl.altindag.crip.command.VersionProvider.<init>()
        at java.base@23.0.1/java.lang.Class.checkConstructor(DynamicHub.java:1171)
        at java.base@23.0.1/java.lang.Class.getConstructor0(DynamicHub.java:1365)
        at java.base@23.0.1/java.lang.Class.getDeclaredConstructor(DynamicHub.java:3004)
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5660)
        at picocli.CommandLine$DefaultFactory.create(CommandLine.java:5687)
        ... 10 more

Steps to Reproduce

  1. Install Graal 22 and 23 from https://www.graalvm.org/downloads/
  2. Make sure your java home is configured to point to version Graal 22
  3. Install maven
  4. run git clone https://github.com/Hakky54/certificate-ripper.git
  5. run mvn clean install -Pnative-image
  6. run ./target/crip (it does not give a runtime exception)
  7. configure java home to graal 23
  8. repeat step 5 and 6 and the runtime exception will be shown

Additional Context

No response

Run-Time Log Output and Error Messages

No response

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions