-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
native-image: fails to create image when --language:js is included. #589
Comments
Can you try adding the |
When I use |
Thanks! The trace is basically the same as in #494. That's a somewhat complicated corner case of the logic that deals with incomplete class paths. The issue appears when you load/store a field with a known type, but the field is declared by a class that has also some fields with unknown types, so our eager class resolution chockes. This error should be pushed to runtime when using |
The error says This is a pretty simple case, I think. The jar I am using is a fat jar including the code in my simple project, plus the I hope this helps you resolve the issue. Thanks! |
The error that you reported should be fixed. See #494 (comment) for reference. You were probably hitting that issue due to some classpath configuration error since I am not able to reproduce it with your repo. I cloned your project and I was able to build the image even with GraalVM 1.0.0 rc5, i.e., without my fix, without hitting that issue and without using
There might be some issue with how the nashorn compatibility mode is set. |
Your code tries to get the |
There should be no need to use |
I don't think that's possible. As I mentioned before, I am using a fat jar so there's nothing else in the classpath, only a single jar. Did you take jars separately to create the image? In my project, I also get a NPE if I don't use the |
Here is what I get with a fresh clone of your repo:
|
You need to checkout branch 'works-on-jvm-but-not-graalvm'. I've been using the GraalVM Polyglot API now as that works, but the bug is happening with the |
I tried the
As @olpaw said the NPE at the end is something that we need to fix, but I don't get your initial reported issue. |
I realized just now that I was using RC4, which I downloaded just a few days ago!
|
I have the same issue when I use my vert.x program: https://github.com/dteam-top/dgate $ echo $JAVA_HOME
/home/fengyu/graalvm-ce-1.0.0-rc6/
$ ~/graalvm-ce-1.0.0-rc6/bin/java -version
openjdk version "1.8.0_172"
OpenJDK Runtime Environment (build 1.8.0_172-20180625212755.graaluser.jdk8u-src-tar-g-b11)
GraalVM 1.0.0-rc6 (build 25.71-b01-internal-jvmci-0.48, mixed mode)
$ gradle shadowjar
$ ~/graalvm-ce-1.0.0-rc6/bin/java -jar build/libs/dgate-0.1.5-fat.jar # works very well
$ ~/graalvm-ce-1.0.0-rc6/bin/native-image -jar build/libs/dgate-0.1.5-fat.jar
Build on Server(pid: 22897, port: 43231)*
[dgate-0.1.5-fat:22897] classlist: 12,065.61 ms
[dgate-0.1.5-fat:22897] (cap): 1,423.68 ms
[dgate-0.1.5-fat:22897] setup: 2,700.90 ms
[dgate-0.1.5-fat:22897] (typeflow): 15,362.86 ms
[dgate-0.1.5-fat:22897] (objects): 4,325.05 ms
[dgate-0.1.5-fat:22897] (features): 81.41 ms
[dgate-0.1.5-fat:22897] analysis: 19,948.87 ms
[dgate-0.1.5-fat:22897] universe: 554.48 ms
[dgate-0.1.5-fat:22897] (parse): 1,969.18 ms
[dgate-0.1.5-fat:22897] (inline): 2,250.13 ms
[dgate-0.1.5-fat:22897] (compile): 9,366.35 ms
[dgate-0.1.5-fat:22897] compile: 14,265.47 ms
[dgate-0.1.5-fat:22897] image: 1,685.53 ms
[dgate-0.1.5-fat:22897] write: 354.49 ms
[dgate-0.1.5-fat:22897] [total]: 51,684.09 ms
$ ldd dgate-0.1.5-fat
linux-vdso.so.1 (0x00007fffc05a4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcf276f6000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fcf274ee000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcf270fd000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf2828c000)
$ ./dgate-0.1.5-fat
Exception in thread "main" java.lang.NullPointerException
at io.vertx.core.impl.launcher.CommandLineUtils.getJar(CommandLineUtils.java:41)
at io.vertx.core.impl.launcher.VertxCommandLauncher.getCommandLinePrefix(VertxCommandLauncher.java:298)
at io.vertx.core.impl.launcher.VertxCommandLauncher.printGlobalUsage(VertxCommandLauncher.java:276)
at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:393)
at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:328)
at top.dteam.dgate.Launcher.main(Launcher.java:24)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:163)
|
The original error has been fixed. When you build an image with |
I have a small Java project that tries to run a JS script.
I coded it against the old
ScriptManager
API and it works when running with HotSpot/Nashorn.It also seems to work fine when I compile and run using GraalVM like a normal JVM.
Now, when I try to create a native image including the JS environment, it does not work:
Error:
If I do not include the
--language:js
argument, it creates the image, but then it does not find the JS script engine.Is there something I can do to work around the problem for now, or I will have to wait for a bug fix?
The text was updated successfully, but these errors were encountered: