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

Problems with finding main entry class for uberjar and native-image #36

Open
jumski opened this issue Apr 20, 2020 · 0 comments
Open

Problems with finding main entry class for uberjar and native-image #36

jumski opened this issue Apr 20, 2020 · 0 comments

Comments

@jumski
Copy link

jumski commented Apr 20, 2020

Got a simple cljfx project that i want to get built with cambada (ideally with native-image, but i'm kind of stuck on uberjar now).

Project repo: https://github.com/jumski/tone-collector/tree/add-cambada

My deps.edn file:

{:deps
 {org.clojure/clojure {:mvn/version "1.10.0"}
  cljfx {:mvn/version "1.6.7"}
  overtone/midi-clj {:mvn/version "0.5.0"}}
 :aliases
 {:uberjar {:extra-deps {luchiniatwork/cambada {:mvn/version "1.0.2"}}
            :main-opts ["-m" "cambada.uberjar"
                        "-m" "jumski.tone-collector.core"]}}}

Building uberjar

It mainly works with small warnings (that i assume are insignificant because they are about some logger)

warnings

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

But when i try to run the uberjar with

java -jar target/tone-collector-1.0.0-SNAPSHOT-standalone.jar

I got this error:

Error: Could not find or load main class jumski.tone-collector.core
Caused by: java.lang.ClassNotFoundException: jumski.tone-collector.core

By trial and error i figured out that when i provide the -m as a slash/underscore path like this, it will work:

-                        "-m" "jumski.tone-collector.core"]}}}
+                        "-m" "jumski/tone_collector/core"]}}}

I do not really understand what is the problem here.

Building native-image

When i try to use native-image support it fails with ERROR! Error: Main entry point class 'jumski.tone-collector.core not found for both jumski.tone-collector.core and jumski/tone_collector/core variants of main entry point spec.

Error for `jumski.tone-collector.core`

ERROR! Error: Main entry point class 'jumski.tone-collector.core' not found.
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'jumski.tone-collector.core' not found.
        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:300)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:501)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:528)
Error: Image build request failed with exit status 1

Error for `jumski/tone_collector/core`

ERROR! Error: Main entry point class 'jumski/tone_collector/core' not found.
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'jumski/tone_collector/core' not found.
        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:300)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:501)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:528)
Error: Image build request failed with exit status 1

Am i missing something or there is some kind or problem in cambada?

Versions

› clj --help
Version: 1.10.1.536

› gu --help
GraalVM Component Updater v2.0.0

› native-image --version
GraalVM Version 20.0.0 CE

› java --version
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant