vertx-web
vertx-web copied to clipboard
OpenAPI has reference to RouteToEBServiceHandler causing GraalVM Build Error
Version
4.1.4
Context
In using Vert.x Web OpenAPI, there seems to be an internal reference to io.vertx.ext.web.api.service.RouteToEBServiceHandler. See the build error below. This forces me to use --allow-incomplete-classpath to compile my application. See the reproducer link.
There should ideally be a clean separation to allow for native building.
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.vertx.ext.web.api.service.RouteToEBServiceHandler. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
at parsing io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter(OpenAPI3RouterBuilderImpl.java:284)
Call path from entry point to io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter():
at io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter(OpenAPI3RouterBuilderImpl.java:246)
at io.vertx.mutiny.ext.web.openapi.RouterBuilder.createRouter(RouterBuilder.java:230)
at org.acme.PetStoreRouter.init(PetStoreRouter.java:32)
at org.acme.PetStoreRouter_Observer_init_9004fe6b5c79f85a6619a8204627d9d96f04f8a9.notify(PetStoreRouter_Observer_init_9004fe6b5c79f85a6619a8204627d9d96f04f8a9.zig:147)
at io.quarkus.arc.impl.EventImpl$DeferredEventNotification.run(EventImpl.java:462)
at java.lang.Thread.run(Thread.java:831)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
com.oracle.svm.core.util.UserError$UserException: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.vertx.ext.web.api.service.RouteToEBServiceHandler. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
at parsing io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter(OpenAPI3RouterBuilderImpl.java:284)
Call path from entry point to io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter():
at io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter(OpenAPI3RouterBuilderImpl.java:246)
at io.vertx.mutiny.ext.web.openapi.RouterBuilder.createRouter(RouterBuilder.java:230)
at org.acme.PetStoreRouter.init(PetStoreRouter.java:32)
at org.acme.PetStoreRouter_Observer_init_9004fe6b5c79f85a6619a8204627d9d96f04f8a9.notify(PetStoreRouter_Observer_init_9004fe6b5c79f85a6619a8204627d9d96f04f8a9.zig:147)
at io.quarkus.arc.impl.EventImpl$DeferredEventNotification.run(EventImpl.java:462)
at java.lang.Thread.run(Thread.java:831)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:764)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:532)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:491)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:380)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:543)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:573)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.vertx.ext.web.api.service.RouteToEBServiceHandler. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
at parsing io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter(OpenAPI3RouterBuilderImpl.java:284)
Call path from entry point to io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter():
at io.vertx.ext.web.openapi.impl.OpenAPI3RouterBuilderImpl.createRouter(OpenAPI3RouterBuilderImpl.java:246)
at io.vertx.mutiny.ext.web.openapi.RouterBuilder.createRouter(RouterBuilder.java:230)
at org.acme.PetStoreRouter.init(PetStoreRouter.java:32)
at org.acme.PetStoreRouter_Observer_init_9004fe6b5c79f85a6619a8204627d9d96f04f8a9.notify(PetStoreRouter_Observer_init_9004fe6b5c79f85a6619a8204627d9d96f04f8a9.zig:147)
at io.quarkus.arc.impl.EventImpl$DeferredEventNotification.run(EventImpl.java:462)
at java.lang.Thread.run(Thread.java:831)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:761)
... 6 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.vertx.ext.web.api.service.RouteToEBServiceHandler. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:311)
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedType(SharedGraphBuilderPhase.java:267)
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:293)
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:256)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1654)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1629)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5373)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3431)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3391)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3236)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1122)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1007)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:81)
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:212)
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.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:131)
at com.oracle.svm.hosted.SVMHost.parseBytecode(SVMHost.java:709)
at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:605)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:163)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:321)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:293)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:282)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:222)
at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:471)
at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:540)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:539)
at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:188)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:172)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1434)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Do you have a reproducer?
https://github.com/murphye/vertx-web-openapi-quarkus-petstore/tree/RouteToEBServiceHandler-unresolved-graalvm
Steps to reproduce
- ./mvnw clean package -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:21.2.0-java16
This is a tricky one to solve. The issue seems to arise when we try to mount an arbitrary object and reflection is used to identify the available methods to expose to the eventbus.
We may need to introduce a type safe alternative to provide this mapping.