native-image Bytecode parsing error
Leonardo Loch Zanivan
pangalz at gmail.com
Tue Dec 5 15:51:55 UTC 2017
I'm trying to create an image from a simple Jetty (9.4.8.v20171121) web
application and I got the following error:
error: unsupported features in 3 methods
Detailed message:
Error: Bytecode parsing error: Must not have a Thread in the image heap.
Trace:
at parsing
org.eclipse.jetty.util.thread.ShutdownThread.deregister(ShutdownThread.java:117)
Call path from entry point to
org.eclipse.jetty.util.thread.ShutdownThread.deregister(LifeCycle):
at
org.eclipse.jetty.util.thread.ShutdownThread.deregister(ShutdownThread.java:117)
at org.eclipse.jetty.server.Server.doStop(Server.java:497)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at
org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.stopLifeCycles(ShutdownMonitor.java:443)
at
org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.run(ShutdownMonitor.java:386)
at java.lang.Thread.run(Thread.java:748)
at
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:188)
at
Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_002epthreadStartRoutine_0028com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_0024ThreadStartData_0029(generated:0)
Error: Bytecode parsing error: Must not have a Thread in the image heap.
Trace:
at parsing
org.eclipse.jetty.util.thread.ShutdownThread.isRegistered(ShutdownThread.java:125)
Call path from entry point to
org.eclipse.jetty.util.thread.ShutdownThread.isRegistered(LifeCycle):
at
org.eclipse.jetty.util.thread.ShutdownThread.isRegistered(ShutdownThread.java:125)
at
org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable$$Lambda$449/1436526075.test(Unknown
Source)
at
org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.stopLifeCycles(ShutdownMonitor.java:442)
at
org.eclipse.jetty.server.ShutdownMonitor$ShutdownMonitorRunnable.run(ShutdownMonitor.java:386)
at java.lang.Thread.run(Thread.java:748)
at
com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:188)
at
Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_002epthreadStartRoutine_0028com_002eoracle_002esvm_002ecore_002eposix_002ethread_002ePosixJavaThreads_0024ThreadStartData_0029(generated:0)
Error: Bytecode parsing error: Must not have a Thread in the image heap.
Trace:
at parsing
org.eclipse.jetty.util.thread.ShutdownThread.register(ShutdownThread.java:101)
Call path from entry point to
org.eclipse.jetty.util.thread.ShutdownThread.register(LifeCycle[]):
at
org.eclipse.jetty.util.thread.ShutdownThread.register(ShutdownThread.java:101)
at org.eclipse.jetty.server.Server.doStart(Server.java:361)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at panga.jetty.graal.Main.main(Main.java:31)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:137)
at
Lcom/oracle/svm/core/code/CEntryPointCallStubs;.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
Main class:
package panga.jetty.graal;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
public class Main extends AbstractHandler {
@Override
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException {
response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().println("Hello World");
baseRequest.setHandled(true);
}
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
server.setHandler(new Main());
server.start();
server.join();
}
}
Command:
$ native-image -jar jetty-graal-1.0-SNAPSHOT-fat.jar
-H:+ReportUnsupportedElementsAtRuntime
Note: GraalVM 0.30
More information about the graal-dev
mailing list