Skip to content

Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.19:compile-no-fork (build-native) #35505

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
otcyury opened this issue May 17, 2023 · 12 comments
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@otcyury
Copy link

otcyury commented May 17, 2023

I am trying to compile natively Spring Boot (version 3.0.2) application, which I am able to run successfully in JVM. The build fails on the following step [4/7] Parsing methods... with following stack trace. I am also attaching POM file I used. Before building this app I ran it with GraalVM agent and generated config files.

pom.zip

5 fatal errors detected:
Fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Discovered an unresolved callee while parsing org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:128).
        at parsing org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:128)
        at method: RequestAttributes org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes()
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:201)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:144)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:1145)
        at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:857)
        at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:386)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.oracle.svm.core.util.VMError$HostedError: Discovered an unresolved callee while parsing org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:128).
        at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.lookupMethodInPool(SharedGraphBuilderPhase.java:140)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:4206)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1648)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5288)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
        ... 23 more
Fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.util.AnalysisError$TypeNotFoundError: Type not found during analysis: HotSpotType<Lorg/springframework/data/repository/util/ReactiveWrapperConverters$RxJava3SingleWrapper;, resolved>
        at parsing org.springframework.data.repository.util.ReactiveWrapperConverters.<clinit>(ReactiveWrapperConverters.java:79)
        at method: void org.springframework.data.repository.util.ReactiveWrapperConverters.<clinit>()
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:201)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:144)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:1145)
        at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:857)
        at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:386)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.oracle.graal.pointsto.util.AnalysisError$TypeNotFoundError: Type not found during analysis: HotSpotType<Lorg/springframework/data/repository/util/ReactiveWrapperConverters$RxJava3SingleWrapper;, resolved>
        at com.oracle.graal.pointsto.util.AnalysisError.typeNotFound(AnalysisError.java:149)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:229)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:213)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:190)
        at com.oracle.graal.pointsto.infrastructure.AnalysisConstantPool.lookupField(AnalysisConstantPool.java:48)
        at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupField(WrappedConstantPool.java:175)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupField(BytecodeParser.java:4234)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genGetStatic(BytecodeParser.java:4771)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5282)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
        ... 23 more
Fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Discovered an unresolved callee while parsing org.springframework.data.util.NullableWrapperConverters.<clinit>(NullableWrapperConverters.java:79).
        at parsing org.springframework.data.util.NullableWrapperConverters.<clinit>(NullableWrapperConverters.java:79)
        at method: void org.springframework.data.util.NullableWrapperConverters.<clinit>()
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:201)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:144)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:1145)
        at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:857)
        at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:386)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.oracle.svm.core.util.VMError$HostedError: Discovered an unresolved callee while parsing org.springframework.data.util.NullableWrapperConverters.<clinit>(NullableWrapperConverters.java:79).
        at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.lookupMethodInPool(SharedGraphBuilderPhase.java:140)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:4206)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1648)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5288)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
        ... 23 more
Fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.svm.core.util.VMError$HostedError: Discovered an unresolved callee while parsing reactor.netty.resources.DefaultLoopNativeDetector.<clinit>(DefaultLoopNativeDetector.java:33).
        at parsing reactor.netty.resources.DefaultLoopNativeDetector.<clinit>(DefaultLoopNativeDetector.java:33)
        at method: void reactor.netty.resources.DefaultLoopNativeDetector.<clinit>()
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:201)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:144)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:1145)
        at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:857)
        at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:386)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.oracle.svm.core.util.VMError$HostedError: Discovered an unresolved callee while parsing reactor.netty.resources.DefaultLoopNativeDetector.<clinit>(DefaultLoopNativeDetector.java:33).
        at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.lookupMethodInPool(SharedGraphBuilderPhase.java:140)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:4206)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeSpecial(BytecodeParser.java:1767)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5287)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
        ... 23 more
Fatal error: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.NullPointerException: Cannot invoke "jdk.vm.ci.meta.JavaType.toJavaName()" because "type" is null
        at parsing org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>(AllEncompassingFormHttpMessageConverter.java:82)
        at method: void org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter.<init>()
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2518)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:110)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3393)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:201)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3345)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3190)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1138)
        at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:144)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:97)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:84)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:446)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:1145)
        at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:857)
        at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:386)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool.externalHelpQuiescePool(ForkJoinPool.java:2104)
        at java.base/java.util.concurrent.ForkJoinPool.awaitQuiescence(ForkJoinPool.java:3321)
        at com.oracle.graal.pointsto.util.CompletionExecutor.complete(CompletionExecutor.java:243)
        at com.oracle.svm.hosted.code.CompileQueue.parseAll(CompileQueue.java:594)
        at com.oracle.svm.hosted.code.CompileQueue.finish(CompileQueue.java:424)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:651)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:610)
Caused by: java.lang.NullPointerException: Cannot invoke "jdk.vm.ci.meta.JavaType.toJavaName()" because "type" is null
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedType(SharedGraphBuilderPhase.java:290)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedNewInstance(SharedGraphBuilderPhase.java:204)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4501)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4494)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5291)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3385)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 17, 2023
@wilkinsona
Copy link
Member

wilkinsona commented May 17, 2023

That looks like a Graal bug to me. Please make sure you're using an up-to-date version of Graal. It's also worth upgrading to the latest Spring Boot 3.0.x release to pick up a recent version of the Native Maven plugin as well.

If those upgrades do not help and you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label May 17, 2023
@otcyury
Copy link
Author

otcyury commented May 17, 2023

I am using Graal 22.3.1 with Java 17. Switching to Spring Boot 3.0.4 immediately gave me following exception.

[INFO] --- spring-boot-maven-plugin:3.0.4:process-aot (process-aot) @ simple-reporting-service ---
2023-05-17T16:11:27.977-04:00  INFO 7992 --- [           main] c.o.r.SimpleReportingServiceApplication  : Starting SimpleReportingServiceApplication using Java 17.0.6 with PID 7992 (C:\Users\yury\git\simple-reporting-service\target\classes started by yury in c:\Users\yury\git\simple-reporting-service)
2023-05-17T16:11:27.982-04:00  INFO 7992 --- [           main] c.o.r.SimpleReportingServiceApplication  : No active profile set, falling back to 1 default profile: "default"
2023-05-17T16:11:28.832-04:00  INFO 7992 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-05-17T16:11:28.834-04:00  INFO 7992 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2023-05-17T16:11:28.862-04:00  INFO 7992 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 15 ms. Found 0 Redis repository interfaces.
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.springframework.validation.beanvalidation.BeanValidationBeanRegistrationAotProcessor.processAheadOfTime(BeanValidationBeanRegistrationAotProcessor.java:64)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getAotContributions(BeanDefinitionMethodGeneratorFactory.java:151)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:99)
        at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:115)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:48)
        at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:36)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.getContributions(BeanFactoryInitializationAotContributions.java:67)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:49)
        at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:44)
        at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
        at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
        at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
        at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
        at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
        at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
        at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)
Caused by: jakarta.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
        at jakarta.validation.Validation$GenericBootstrapImpl.configure(Validation.java:291)
        at jakarta.validation.Validation.buildDefaultValidatorFactory(Validation.java:103)
        at org.springframework.validation.beanvalidation.BeanValidationBeanRegistrationAotProcessor$BeanValidationDelegate.<clinit>(BeanValidationBeanRegistrationAotProcessor.java:71)

I will provide you with a Zip of built app shortly using Spring Boot 3.0.2.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 17, 2023
@wilkinsona
Copy link
Member

Spring Boot 3.0.6 is the latest release. Any sample should use that version please.

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 17, 2023
@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 17, 2023
@wilkinsona
Copy link
Member

Thanks for the sample. Unfortunately, it isn't minimal and we don't have the bandwidth to look through such a large amount of code and dependencies. Please reduce it to the bare minimum that's required to reproduce the problem. I also suspect that it won't build as it's using a repository (http://devtools.ps:8081/nexus/content/groups/public) to which we do not have access.

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 17, 2023
@otcyury
Copy link
Author

otcyury commented May 18, 2023

No problem, but it's not so simple to achieve minimum reduction. I've tried this twice and the problem is when I start removing classes, even a few of them, the original error gets replaced with some other. And as you can imagine, it's equally impossible for me to know which classes or dependencies I need to remove and which to leave so the original error stays.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 18, 2023
@scottfrederick scottfrederick added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 18, 2023
@otcyury
Copy link
Author

otcyury commented May 22, 2023

Hi, I think this should be a better example. There is a regular (non Spring) class in there with the same code: PrettyPrintJSON. It works fine in native build.
test.zip

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 22, 2023
@wilkinsona
Copy link
Member

Thanks. Can you please provide a complete pom.xml or build.gradle file so that we can easily build the code?

@wilkinsona wilkinsona added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels May 22, 2023
@otcyury
Copy link
Author

otcyury commented May 22, 2023

Sorry, I missed it. Attached. Thanks
pom.txt

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 22, 2023
@mhalbritter
Copy link
Contributor

mhalbritter commented May 23, 2023

I don't get that error when running your project. Instead I get the error that AOT classes are missing, and that's because your project is missing those bits:

    <build>
        <plugins>
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

After adding them, I get this error:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.0.6)

10:08.16.281 [main] INFO  o.s.b.StartupInfoLogger [logStarting:51] - Starting AOT-processed SimpleReportingServiceApplication using Java 17.0.6 with PID 25392 (/home/moe/Downloads/sb-35505/target/native started by moe in /home/moe/Downloads/sb-35505)
 10:08.16.281 [main] INFO  o.s.b.SpringApplication [logStartupProfileInfo:632] - No active profile set, falling back to 1 default profile: "default"
 10:08.16.297 [main] INFO  o.s.b.w.e.t.TomcatWebServer [initialize:108] - Tomcat initialized with port(s): 8080 (http)
 10:08.16.297 [main] INFO  o.a.j.l.DirectJDKLog [log:173] - Initializing ProtocolHandler ["http-nio-8080"]
 10:08.16.298 [main] INFO  o.a.j.l.DirectJDKLog [log:173] - Starting service [Tomcat]
 10:08.16.298 [main] INFO  o.a.j.l.DirectJDKLog [log:173] - Starting Servlet engine: [Apache Tomcat/10.1.8]
 10:08.16.302 [main] INFO  o.a.j.l.DirectJDKLog [log:173] - Initializing Spring embedded WebApplicationContext
 10:08.16.303 [main] INFO  o.s.b.w.s.c.ServletWebServerApplicationContext [prepareWebApplicationContext:291] - Root WebApplicationContext: initialization completed in 22 ms
 10:08.16.319 [main] INFO  o.a.j.l.DirectJDKLog [log:173] - Starting ProtocolHandler ["http-nio-8080"]
 10:08.16.321 [main] INFO  o.s.b.w.e.t.TomcatWebServer [start:220] - Tomcat started on port(s): 8080 (http) with context path ''
 10:08.16.321 [main] INFO  o.s.b.StartupInfoLogger [logStarted:57] - Started SimpleReportingServiceApplication in 0.055 seconds (process running for 0.074)
 10:08.16.321 [main] INFO  o.e.r.SimpleReportingServiceApplication [run:29] - Running
 10:08.16.322 [main] ERROR o.s.b.SpringApplication [reportFailure:822] - Application run failed
 java.lang.IllegalStateException: Failed to execute CommandLineRunner
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:772)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:753)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293)
        at org.example.reporting.SimpleReportingServiceApplication.main(SimpleReportingServiceApplication.java:24)
Caused by: java.lang.IllegalStateException: No language and polyglot implementation was found on the classpath. Make sure a language is added to the classpath (e.g., native-image --language:js).
        at org.graalvm.sdk/org.graalvm.polyglot.Engine$PolyglotInvalid.noPolyglotImplementationFound(Engine.java:1014)
        at org.graalvm.sdk/org.graalvm.polyglot.Engine$PolyglotInvalid.createHostAccess(Engine.java:1004)
        at org.graalvm.sdk/org.graalvm.polyglot.Engine$Builder.build(Engine.java:626)
        at org.graalvm.sdk/org.graalvm.polyglot.Context$Builder.build(Context.java:1851)
        at org.graalvm.sdk/org.graalvm.polyglot.Context.create(Context.java:976)
        at org.example.reporting.SimpleReportingServiceApplication.run(SimpleReportingServiceApplication.java:30)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:769)
        ... 5 common frames omitted

That's because your application is mixing the polyglot features from GraalVM (in org.example.reporting.SimpleReportingServiceApplication#run) with native-image, which is not supported. You could ask the GraalVM team if they plan to support it. But as it stands, this has nothing to do with Spring Boot.

All the stacktraces you've provided show different problems. This seems to have a problem with Validation where in your attached project there's no sign of validation.

So if you think there's a bug in Spring Boot, please upload a minimal sample of the application which triggers the validation error.

@wilkinsona wilkinsona removed the status: feedback-provided Feedback has been provided label May 23, 2023
@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label May 23, 2023
@otcyury
Copy link
Author

otcyury commented May 23, 2023

I build this code in two steps. First I run mvn clean package and create a jar with all dependencies, then I run native-image --language:js -jar ./target/"jar with all dependencies".jar. Passing --language:js to native-image resolves "polyglot" issue. GraalVM allows mixing Java and other languages in one codebase. You will also need to install JavaScript support for GraalVM with following command $GRAALVM/bin/gu install js

If you want to invoke native-image from POM (as have shown above) and handle this situation you need to add "--language:js" directive to "buildArgs" tag in plugin's configuration. I do have this version of build and it gives the same exception I've given.

It's when running native-image command, I provided, I am getting this exception. I have nothing more to subtract from this code as it only has two classes. I do want to keep GraalVM "polyglot" dependencies and small amount of code to make sure it works with Spring in native build.

One is simple Java class with "polyglot" code, which I am able to successfully build following steps in first paragraph. I can build and successfully run executables on Windows and Linux with this class.

Then I added second class, which is annotated as Spring application, for which I had to add to POM Spring parent and one web dependency, since I am planning to use this code in Web app - two more additions in total. Once I made this change and regenerated native directory under META-INF using GraalVM agent, native-image command started throwing original exception I provided. I suspect, after some trial and error approach, it has something to do with content in resource-config.json related to what was generated to it by agent after adding Spring dependencies and code.

Note: If you want to use my approach and be able to execute the code, you will need to change "mainClass" tag inside assembly plugin to point to regular PrettyPrintJSON class instead of Spring - based one.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 23, 2023
@wilkinsona
Copy link
Member

Duplicates oracle/graal#4473.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2023
@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels May 23, 2023
@6484chen
Copy link

Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.24:test (test-native)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

6 participants