Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1408

Undertow does not compile with Graal AOT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Undertow cannot be compiled with the Graal AOT compiler. I would like to do this:

      • create a standard maven project
      • add undertow-core 2.0.13.Final as a dependency
      • add a main with basic undertow code:
          public static void main(final String... args) {
              Undertow.builder()
                  .addHttpListener(8080, "0.0.0.0")
                  .setHandler(exchange -> exchange.getResponseSender().send("Hello, world!\n"))
                  .build().start();
          }
      
      • use the shader to create a fatjar
      • optionally run the fatjar to prove it works on its own
      • install Graal latest version and run native-image

      This error occurs:

      $ native-image -jar test.jar
      Build on Server(pid: 314, port: 39039)*
         classlist:   4,159.03 ms
             (cap):   1,260.87 ms
             setup:   2,727.01 ms
      Sep 01, 2018 2:45:24 PM org.xnio.Xnio <clinit>
      INFO: XNIO version 3.3.8.Final
      Detected unnecessary RecomputeFieldValue.ArrayBaseOffset com.oracle.svm.core.jdk.Target_java_nio_DirectByteBuffer.arrayBaseOffset substitution field for java.nio.DirectByteBuffer.arrayBaseOffset. The annotated field can be removed. This ArrayBaseOffset computation can be detected automatically. Use option -H:+UnsafeAutomaticSubstitutionsLogLevel=2 to print all automatically detected substitutions. 
          analysis:  12,106.93 ms
      error: Error loading a referenced type: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
      Detailed message:
      Error: Error loading a referenced type: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
      Trace: 
              at parsing org.xnio.Xnio$OsgiSupport.doGetOsgiService(Xnio.java:276)
      Call path from entry point to org.xnio.Xnio$OsgiSupport.doGetOsgiService(): 
              at org.xnio.Xnio$OsgiSupport.doGetOsgiService(Xnio.java:276)
              at org.xnio.Xnio.doGetInstance(Xnio.java:261)
              at org.xnio.Xnio.getInstance(Xnio.java:187)
              at io.undertow.Undertow.start(Undertow.java:117)
              at graaltest.Main.main(Main.java:11)
              at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:177)
              at com.oracle.svm.core.code.CEntryPointCallStubs.com_002eoracle_002esvm_002ecore_002eJavaMainWrapper_002erun_0028int_002corg_002egraalvm_002enativeimage_002ec_002etype_002eCCharPointerPointer_0029(generated:0)
      Original exception that caused the problem: java.lang.NoClassDefFoundError: org/osgi/framework/FrameworkUtil
              at jdk.vm.ci.hotspot.CompilerToVM.resolveTypeInPool(Native Method)
              at jdk.vm.ci.hotspot.HotSpotConstantPool.loadReferencedType(HotSpotConstantPool.java:696)
              at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.loadReferencedType(WrappedConstantPool.java:60)
              at org.graalvm.compiler.java.BytecodeParser.maybeEagerlyResolve(BytecodeParser.java:3971)
              at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.maybeEagerlyResolve(SharedGraphBuilderPhase.java:99)
              at org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:3925)
              at org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1422)
              at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.genInvokeStatic(SharedGraphBuilderPhase.java:168)
              at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:4850)
              at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3135)
              at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:2944)
              at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:888)
              at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:782)
              at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:95)
              at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
              at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:197)
              at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
              at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
              at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:196)
              at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:315)
              at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
              at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:300)
              at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
              at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:346)
              at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:502)
              at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:174)
              at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
              at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
              at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
              at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
              at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
      Caused by: java.lang.ClassNotFoundException: org.osgi.framework.FrameworkUtil
              at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
              ... 31 more
      
      Error: Processing image build request failed
      

        Attachments

          Activity

            People

            Assignee:
            swd847 Stuart Douglas
            Reporter:
            codemonstur Jurgen Voorneveld (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: