Skip to content

GraalVM CE 1.0 RC6 breaks Flank fat jar #653

Closed

Description

@bootstraponline

GraalVM CE 1.0 RC6 breaks converting the Flank fat jar to a native executable.

$ git clone https://github.com/TestArmada/flank.git
$ cd test_runner
$ ./gradlew clean assemble fatJar
$ build/libs
$ native-image -jar flank-3.0-SNAPSHOT.jar
./flank-3.0-SNAPSHOT
Exception in thread "main" picocli.CommandLine$InitializationException: Cannot instantiate subcommand ftl.cli.FirebaseCommand: the class has no constructor
	at java.lang.Throwable.<init>(Throwable.java:287)
	at java.lang.Exception.<init>(Exception.java:84)
	at java.lang.RuntimeException.<init>(RuntimeException.java:80)
	at picocli.CommandLine$PicocliException.<init>(CommandLine.java:8801)
	at picocli.CommandLine$InitializationException.<init>(CommandLine.java:8808)
	at picocli.CommandLine$Model$CommandReflection.initSubcommands(CommandLine.java:4912)
	at picocli.CommandLine$Model$CommandReflection.updateCommandAttributes(CommandLine.java:4877)
	at picocli.CommandLine$Model$CommandReflection.extractCommandSpec(CommandLine.java:4858)
	at picocli.CommandLine$Model$CommandSpec.forAnnotatedObject(CommandLine.java:3144)
	at picocli.CommandLine.<init>(CommandLine.java:147)
	at picocli.CommandLine.<init>(CommandLine.java:126)
	at picocli.CommandLine.run(CommandLine.java:1700)
	at picocli.CommandLine.run(CommandLine.java:1647)
	at ftl.Main.main(Main.kt:34)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:163)
Caused by: java.lang.NoSuchMethodException: ftl.cli.FirebaseCommand.<init>()
	at java.lang.Throwable.<init>(Throwable.java:265)
	at java.lang.Exception.<init>(Exception.java:66)
	at java.lang.ReflectiveOperationException.<init>(ReflectiveOperationException.java:56)
	at java.lang.NoSuchMethodException.<init>(NoSuchMethodException.java:51)
	at java.lang.Class.getConstructor0(Class.java:3082)
	at java.lang.Class.getDeclaredConstructor(Class.java:2178)
	at picocli.CommandLine$DefaultFactory.create(CommandLine.java:2832)
	at picocli.CommandLine$Model$CommandReflection.initSubcommands(CommandLine.java:4906)
	... 9 more

Activity

  1. cstancu commented on Sep 4, 2018

    @cstancu
    Member

    Did this work with rc5? From the error message it looks like you need to register ftl.cli.FirebaseCommand.<init>() for reflection access.

  2. bootstraponline commented on Sep 4, 2018

    @bootstraponline
    Author

    Interesting. I'll try to define a reflectconfig. RC5 didn't work either.

  3. bootstraponline commented on Sep 6, 2018

    @bootstraponline
    Author

    Image building is failing after I defined a reflection config JSON.

    I opened a pull request so you can easily reproduce the problem:

  4. dougxc commented on Sep 6, 2018

    @dougxc
    Member

    @cstancu @christianwimmer this looks like the same thing I commented on in #656.

  5. cstancu commented on Feb 8, 2019

    @cstancu
    Member

    @bootstraponline the java.lang.NoClassDefFoundError that your reported after adding the correct reflection configuration was fixed in RC12. You will need to add this options to native-image: --report-unsupported-elements-at-runtime --allow-incomplete-classpath. Also you need to fix the graal_reflectionconfig.json by removing the ftl.cli.firebase.test.android.AndroidRefreshCommand and ftl.cli.firebase.test.ios.IosRefreshCommand entries as those classes don't exist anymore. I guess firebase removed them since you filed this issue.

    However, I still cannot successfully build an image for your app. I hit the same problem reported in #783: Non-instantiated type referenced by a compiled method: kotlin.Result$Companion.

    I am closing this issue. Please follow the progress of #783.

  6. bootstraponline commented on Feb 8, 2019

    @bootstraponline
    Author

    Thank you for looking into this! I'm excited about using graalvm in the future.

  7. cstancu commented on Feb 12, 2019

    @cstancu
    Member

    #783 has been fixed. Now using this command:

    native-image --report-unsupported-elements-at-runtime --allow-incomplete-classpath  -jar ./build/libs/flank-SNAPSHOT.jar -H:ReflectionConfigurationFiles=graal_reflectconfig.json -H:IncludeResources="kotlin/*.*" --enable-url-protocols=http
    

    and this reflection configuration file:

    [
      {
        "name" : "ftl.Main",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.args.yml.FlankYml",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "[Lftl.args.yml.FlankYmlParams;",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.args.yml.GcloudYml",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "[Lftl.args.yml.GcloudYmlParams;",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.RefreshCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.CancelCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.AuthCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.auth.LoginCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
    
      {
        "name" : "ftl.cli.FirebaseCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.TestCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.test.IosCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.test.AndroidCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.test.android.AndroidDoctorCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.test.android.AndroidRunCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.test.ios.IosDoctorCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      },
      {
        "name" : "ftl.cli.firebase.test.ios.IosRunCommand",
        "allDeclaredConstructors" : true,
        "allPublicConstructors" : true,
        "allDeclaredMethods" : true,
        "allPublicMethods" : true
      }
    ]
    

    I can build an executable which when run does something:

    $ ./flank-SNAPSHOT firebase test android run
    The project is not set. Define GOOGLE_CLOUD_PROJECT, set project in flank.yml
    or save service account credential to /home/cdrtz/.config/gcloud/application_default_credentials.json
     See https://github.com/GoogleCloudPlatform/google-cloud-java#specifying-a-project-id
    

    I am not familiar with the internals of your project so I stopped there. I just wanted to see how far I can get it.

  8. bootstraponline commented on Feb 13, 2019

    @bootstraponline
    Author

    I am not familiar with the internals of your project so I stopped there. I just wanted to see how far I can get it.

    Thanks. I made a simple reproducible example that doesn't require authentication with a service account.

    It's awesome to see GraalVM making progress. 🙂

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions