Skip to content

Minimal embedded Jetty program compiles to native exe but throws an java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jetty.http.HttpTokens #2847

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

Closed
ebremer opened this issue Sep 12, 2020 · 4 comments
Assignees

Comments

@ebremer
Copy link

ebremer commented Sep 12, 2020

Describe the issue
Minimal embedded Jetty program compiles to native exe but throws an java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jetty.http.HttpTokens error when connecting to http://localhost:8080

This is using the latest Jetty 9.4.31.v20200723, however, everything works fine reverting to Jetty version 9.4.3.v20170317.

Steps to reproduce the issue

  1. git clone https://github.com/ebremer/eJetty.git
  2. cd eJetty
  3. mvn install
  4. java -agentlib:native-image-agent=config-output-dir=config -cp target/eJetty-1.0.jar com.bugland.ejetty.Start
  5. native-image --no-server --no-fallback --allow-incomplete-classpath -H:ConfigurationFileDirectories=config --report-unsupported-elements-at-runtime --enable-http --enable-https -cp target/eJetty-1.0.jar com.bugland.ejetty.Start ejetty

Describe GraalVM and your environment:

  • GraalVM Version 20.3.0-dev (Java Version null)

java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment GraalVM CE 20.3.0-dev (build 11.0.8+10-jvmci-20.2-b03)
OpenJDK 64-Bit Server VM GraalVM CE 20.3.0-dev (build 11.0.8+10-jvmci-20.2-b03, mixed mode, sharing)

  • OS: Ubuntu 20
  • Intel Core i7-7700HQ @ 2.8Ghz
[qtp1824069247-14] WARN org.eclipse.jetty.util.thread.strategy.EatWhatYouKill -
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.jetty.http.HttpTokens
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:215)
        at org.eclipse.jetty.http.HttpGenerator.generateResponseLine(HttpGenerator.java:558)
        at org.eclipse.jetty.http.HttpGenerator.generateResponse(HttpGenerator.java:412)
        at org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:738)
        at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)
        at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:223)
        at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:544)
        at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:833)
        at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:851)
        at org.eclipse.jetty.server.HttpChannel.onBadMessage(HttpChannel.java:784)
        at org.eclipse.jetty.server.HttpChannelOverHttp.badMessage(HttpChannelOverHttp.java:283)
        at org.eclipse.jetty.http.HttpParser.badMessage(HttpParser.java:1628)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1615)
        at org.eclipse.jetty.server.HttpConnection.parseRequestBuffer(HttpConnection.java:364)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:261)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
        at java.lang.Thread.run(Thread.java:834)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:518)
        at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
@oubidar-Abderrahim
Copy link
Member

Do you get the same error while using the current version v20.2.0? what happens if you remove the --report-unsupported-elements-at-runtime flag?

@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Sep 14, 2020
@ebremer
Copy link
Author

ebremer commented Sep 14, 2020

Same issue with 20.2.0. I tried the dev build to see if it was an issue already fixed before reporting it. Without that flag, I get:

Error: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1102)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findStatic(Class, String, MethodType):
        no path found from entry point to target method

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:1194)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findVirtual(Class, String, MethodType):
        no path found from entry point to target method

@ebremer
Copy link
Author

ebremer commented Sep 14, 2020

if I add "-H:+ReportExceptionStackTraces" and run it, I get:

[ejetty:834]    classlist:   3,120.50 ms,  0.96 GB
[ejetty:834]        (cap):   1,426.68 ms,  0.96 GB
[ejetty:834]        setup:   2,867.52 ms,  0.96 GB
[ejetty:834]     (clinit):     335.34 ms,  2.31 GB
[ejetty:834]   (typeflow):   9,677.62 ms,  2.31 GB
[ejetty:834]    (objects):  15,545.94 ms,  2.31 GB
[ejetty:834]   (features):   1,136.83 ms,  2.31 GB
[ejetty:834]     analysis:  27,342.75 ms,  2.31 GB
Error: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1102)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findStatic(Class, String, MethodType):
        no path found from entry point to target method

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:1194)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findVirtual(Class, String, MethodType):
        no path found from entry point to target method


com.oracle.svm.core.util.UserError$UserException: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1102)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findStatic(Class, String, MethodType):
        no path found from entry point to target method

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:1194)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findVirtual(Class, String, MethodType):
        no path found from entry point to target method


        at com.oracle.svm.core.util.UserError.abort(UserError.java:79)
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:217)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
        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:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findStatic(MethodHandles.java:1102)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findStatic(Class, String, MethodType):
        no path found from entry point to target method

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace:
        at parsing java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:1194)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findVirtual(Class, String, MethodType):
        no path found from entry point to target method


        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:762)
        ... 8 more
Error: Image build request failed with exit status 1

@cstancu
Copy link
Member

cstancu commented Sep 23, 2020

The underlying issue here is incomplete MethodHandle support. That is under development and is being tracked by #2761.

@cstancu cstancu closed this as completed Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants