Tested with graalvm-ce-java11-windows-amd64-19.3.0.
Test.java:
public class Test {
public static void main(String[] args) throws Exception {
java.net.Socket s = new java.net.Socket("localhost", 12345);
}
}
Error messages:
C:\>java -version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-jvmci-19.3-b05-LTS)
OpenJDK 64-Bit GraalVM CE 19.3.0 (build 11.0.5+10-jvmci-19.3-b05-LTS, mixed mode, sharing)
C:\>javac Test.java
C:\>native-image Test
[Test:9636] classlist: 3,697.39 ms
[Test:9636] (cap): 6,826.52 ms
[Test:9636] setup: 11,013.38 ms
[Test:9636] analysis: 18,083.82 ms
Fatal error: com.oracle.svm.core.util.VMError$HostedError: class java.net.TwoStacksPlainSocketImpl not found
at com.oracle.svm.core.util.VMError.guarantee(VMError.java:85)
at com.oracle.svm.core.jdk.JNIRegistrationUtil.clazz(JNIRegistrationUtil.java:71)
at com.oracle.svm.core.jdk.JNIRegistrationUtil.fields(JNIRegistrationUtil.java:84)
at com.oracle.svm.hosted.jdk.JNIRegistrationJavaNet.registerPlainSocketImplInitProto(JNIRegistrationJavaNet.java:229)
at com.oracle.svm.hosted.ReachabilityHandlerFeature.duringAnalysis(ReachabilityHandlerFeature.java:114)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:710)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:710)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1
Did anybody discover a workaround? The problem also occurs on graalvm-ce-java8-windows-amd64-19.3.0.
@nightscape, could you provide a stack trace of the error on JDK 8. I'm working on a fix, so it might be useful.
@pejovica sorry, my bad. Something had gone wrong when switching from the JDK 11 to the JDK 8 version and I was apparently still using the JDK 11 version of native-image.
I ran the example from @znbang again with the JDK 8 version and it worked.
Fixed in 123a027213cab3113b5a412304f105900f4f54a8.
@pejovica When do you expect 123a027 to be released?
@mcred In GraalVM 20.0 early next year.
Why not in 19.3.1 ?
Most helpful comment
@mcred In GraalVM 20.0 early next year.