Spring Boot 2.3 + GraalVM Error encountered while parsing config - spring

I have a spring boot 2.3 app which I want to compile as a native image.
I'm using GraalVM 20.1.0.r11-grl as the SDK/JDK and my application compiles and runs fine.
I'm using Gradle for my build tool, and am using https://github.com/ayltai/spring-graalvm-native-plugin to access Native Image functionality - it works well.
When I try to compile a native image, I get the following stack trace (the original is about 900 lines long in verbose mode so I'm trying to pick out the relevant bits):
WARNING: Could not register reflection metadata for org.springframework.boot.actuate.autoconfigure.endpoint.web.reactive.WebFluxEndpointManagementContextConfiguration. Reason: java.lang.NoClassDefFoundError: org/springframework/web/reactive/result/method/annotation/RequestMappingHandlerMapping.
WARNING: Could not register reflection metadata for org.springframework.boot.actuate.autoconfigure.web.jersey.JerseySameManagementContextConfiguration. Reason: java.lang.NoClassDefFoundError: org/glassfish/jersey/server/ResourceConfig.
[valuable-api:14937] analysis: 53,754.65 ms, 3.98 GB
Fatal error:com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing org.springframework.hateoas.config.WebFluxHateoasConfiguration$WebFluxCodecs.getDecoder(com.fasterxml.jackson.databind.ObjectMapper, java.util.List)
Parsing context:
parsing com.oracle.svm.reflect.WebFluxHateoasConfiguration$WebFluxCodecs_getDecoder_ebe8383216b03b797b6e4dde145c81aea1634443_11905.invoke(Unknown Source)
parsing java.lang.reflect.Method.invoke(Method.java:566)
parsing org.springframework.core.convert.support.ObjectToObjectConverter.convert(ObjectToObjectConverter.java:102)
parsing org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
parsing org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:191)
parsing org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:174)
parsing org.springframework.core.env.AbstractPropertyResolver.convertValueIfNecessary(AbstractPropertyResolver.java:265)
parsing org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:91)
parsing org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:62)
parsing org.springframework.core.env.AbstractPropertyResolver.getProperty(AbstractPropertyResolver.java:169)
parsing org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:540)
parsing org.springframework.boot.SpringApplicationBannerPrinter.createStringFromBanner(SpringApplicationBannerPrinter.java:116)
parsing org.springframework.boot.SpringApplicationBannerPrinter.print(SpringApplicationBannerPrinter.java:61)
parsing org.springframework.boot.SpringApplication.printBanner(SpringApplication.java:556)
parsing org.springframework.boot.SpringApplication.run(SpringApplication.java:310)
parsing org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
parsing org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
parsing nz.ringfence.valuable.api.ValuableApiApplication.main(ValuableApiApplication.java:11)
parsing com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:149)
parsing com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:184)
parsing com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:336)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:311)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:112)
at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:437)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:530)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
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:177)
Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
at parsing org.springframework.hateoas.config.WebFluxHateoasConfiguration$WebFluxCodecs.getDecoder(WebFluxHateoasConfiguration.java:123)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2590)
at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:94)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3428)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3230)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1088)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:982)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.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:214)
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.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:225)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:352)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:322)
... 11 more
Caused by: java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
at jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVM.getDeclaredMethods(Native Method)
at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getDeclaredMethods(HotSpotResolvedObjectTypeImpl.java:958)
at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.declaresDefaultMethods(ClassInitializationFeature.java:385)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.processInterfaces(ConfigurableClassInitialization.java:606)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:565)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:132)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.maybeInitializeHosted(ConfigurableClassInitialization.java:160)
at com.oracle.svm.hosted.SVMHost.registerType(SVMHost.java:223)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:264)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:182)
at com.oracle.graal.pointsto.meta.AnalysisType.convertTypes(AnalysisType.java:209)
at com.oracle.graal.pointsto.meta.AnalysisType.<init>(AnalysisType.java:169)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:263)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:182)
at com.oracle.graal.pointsto.meta.AnalysisType.<init>(AnalysisType.java:168)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:263)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupType(WrappedConstantPool.java:155)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupType(BytecodeParser.java:4274)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4545)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5343)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3423)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Publisher
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 46 more
Error: Image build request failed with exit status 1
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1541)
at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1299)
at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1260)
at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1219)
at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1722)
So this error appears to be happening because Native Image thinks I have a WebFlux component on my classpath, and when it tried to process that component, it can't find it, hence the ClassNotFoundException at the bottom of the trace.
Here are my dependencies:
// Spring Boot
implementation('org.springframework.boot:spring-boot-starter-actuator')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.hateoas:spring-hateoas:1.1.1.RELEASE')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-security')
implementation('org.springframework.boot:spring-boot-starter-aop')
implementation('org.springframework.boot:spring-boot-starter-validation')
runtimeOnly('org.springframework.boot:spring-boot-devtools')
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
// Native Image
implementation('org.springframework:spring-context-indexer')
implementation('org.springframework.experimental:spring-graalvm-native:0.7.1')
// Testing
testImplementation('org.junit.jupiter:junit-jupiter-api:5.3.1')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.3.1')
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation("org.assertj:assertj-core:3.12.0")
testImplementation 'org.mockito:mockito-core:2.+'
testImplementation "org.springframework.security:spring-security-test"
testImplementation 'com.intuit.karate:karate-junit5:0.9.5'
testImplementation 'com.intuit.karate:karate-apache:0.9.5'
testImplementation "net.masterthought:cucumber-reporting:3.8.0"
// Persistence
implementation('com.h2database:h2')
implementation('org.postgresql:postgresql')
implementation('org.springframework.boot:spring-boot-starter-jdbc')
implementation "org.flywaydb:flyway-core"
// Swagger
implementation 'org.springdoc:springdoc-openapi-ui:1.3.0'
// Observability
implementation 'io.sentry:sentry-spring:1.7.30'
implementation 'io.honeycomb.beeline:beeline-spring-boot-starter:1.2.0'
implementation 'nl.basjes.parse.useragent:yauaa:5.18'
// Security
implementation 'com.auth0:auth0-spring-security-api:1.3.1'
implementation 'org.springframework.security:spring-security-oauth2-resource-server'
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.security:spring-security-config'
// Outgoing Email
implementation 'com.sendgrid:sendgrid-java:4.0.1'
There are no reactive components there. The only thing I can think of is that there is a transitive dependency somewhere, but it doesn't make sense that a non-reactive component would have a transitive dependency?
Has anyone had this issue before? How can I debug and fix this?

Related

Quarkus build native with graalvm polyglot embed script language runtime error

Quarkus and Graalvm version
quarkusPluginId=io.quarkus
quarkusPluginVersion=2.15.3.Final
quarkusPlatformGroupId=io.quarkus.platform
quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformVersion=2.15.3.Final
graalVmVersion=22.3.0
I want use Quarkus with Graalvm embed script language and native image
dependencies
dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-resteasy-reactive'
implementation 'io.quarkus:quarkus-config-yaml'
implementation 'io.quarkus:quarkus-arc'
implementation 'org.graalvm.sdk:graal-sdk:${graalVmVersion}'
implementation 'org.graalvm.js:js:${graalVmVersion}'
implementation 'org.graalvm.truffle:truffle-api:${graalVmVersion}'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
}
build script
./gradlew build -Dquarkus.package.type=native -Dquarkus.native.additional-build-args="--language:js"
When I use these dependencies, everything just work.
But when I add hibernate dependency
implementation 'io.quarkus:quarkus-hibernate-orm'
implementation 'io.quarkus:quarkus-hibernate-orm-panache'
implementation 'io.quarkus:quarkus-jdbc-h2'
Run the build script will show me this error
> Task :quarkusBuild
[2/7] Performing analysis... [**] (29.6s # 3.50GB)
27,299 (94.12%) of 29,005 classes reachable
45,307 (64.02%) of 70,775 fields reachable
144,092 (65.40%) of 220,308 methods reachable
700 classes, 125 fields, and 3,347 methods registered for reflection
1 native library: -framework CoreServices
Error: Classes that should be initialized at run time got initialized during image building:
Error: Classes that should be initialized at run time got initialized during image building:
com.ibm.icu.impl.ICUDebug the class was requested to be initialized at run time (from language option 'icu4j#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/icu4j/' with 'com.ibm.icu' and from language option 'js#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/js/' with 'com.ibm.icu'). To see why com.ibm.icu.impl.ICUDebug got initialized use --trace-class-initialization=com.ibm.icu.impl.ICUDebug
com.ibm.icu.text.Collator the class was requested to be initialized at run time (from language option 'icu4j#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/icu4j/' with 'com.ibm.icu' and from language option 'js#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/js/' with 'com.ibm.icu'). To see why com.ibm.icu.text.Collator got initialized use --trace-class-initialization=com.ibm.icu.text.Collator
------------------------------------------------------------------------------------------------------------------------
To see how the classes got initialized, use --trace-class-initialization=com.ibm.icu.impl.ICUDebug,com.ibm.icu.text.Collator
com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
com.ibm.icu.impl.ICUDebug the class was requested to be initialized at run time (from language option 'icu4j#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/icu4j/' with 'com.ibm.icu' and from language option 'js#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/js/' with 'com.ibm.icu'). To see why com.ibm.icu.impl.ICUDebug got initialized use --trace-class-initialization=com.ibm.icu.impl.ICUDebug
com.ibm.icu.text.Collator the class was requested to be initialized at run time (from language option 'icu4j#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/icu4j/' with 'com.ibm.icu' and from language option 'js#file:///Users/d/.sdkman/candidates/java/22.3.r17-grl/languages/js/' with 'com.ibm.icu'). To see why com.ibm.icu.text.Collator got initialized use --trace-class-initialization=com.ibm.icu.text.Collator
To see how the classes got initialized, use --trace-class-initialization=com.ibm.icu.impl.ICUDebug,com.ibm.icu.text.Collator
at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
at com.oracle.svm.hosted.classinitialization.ProvenSafeClassInitializationSupport.checkDelayedInitialization(ProvenSafeClassInitializationSupport.java:273)
at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:164)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:748)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:85)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:748)
at com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:162)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:745)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:578)
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)
3.8s (9.3% of total time) in 26 GCs | Peak RSS: 6.03GB | CPU load: 3.93
========================================================================================================================
Failed generating 'demo-1.0-SNAPSHOT-runner' after 40.3s.
Error: Image build request failed with exit status 1
Error: Image build request failed with exit status 1
> Task :quarkusBuild FAILED
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:421)
at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:262)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
So I add a arguments in build command
./gradlew build -Dquarkus.package.type=native -Dquarkus.native.additional-build-args="--language:js" -Dquarkus.native.additional-build-args="--initialize-at-build-time=com.ibm.icu"
And this build command just work, but when I run the built binary and access api that use graalvm polyglot sdk, in runtime will show error
2023-01-14 13:17:10,847 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /hello failed, error id: 36b4f719-2397-4766-ac15-c221327bf2c4-1: 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 com.example.ExampleResource.hello(ExampleResource.java:16)
at com.example.ExampleResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base#17.0.5/java.lang.Thread.run(Thread.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
2023-01-14 13:17:10,876 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: 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 com.example.ExampleResource.hello(ExampleResource.java:16)
at com.example.ExampleResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base#17.0.5/java.lang.Thread.run(Thread.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
2023-01-14 13:17:11,056 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /hello failed, error id: 36b4f719-2397-4766-ac15-c221327bf2c4-2: 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 com.example.ExampleResource.hello(ExampleResource.java:16)
at com.example.ExampleResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base#17.0.5/java.lang.Thread.run(Thread.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
2023-01-14 13:17:11,058 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: 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 com.example.ExampleResource.hello(ExampleResource.java:16)
at com.example.ExampleResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base#17.0.5/java.lang.Thread.run(Thread.java:833)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
It make me confused and how to resolve this problem
Use graalvm embed sciprt language in quarkus
As explained here, using GraalVM plolyglot is not something Quarkus supports

Transitive dependency missing in development mode

In a simple REST service built with Quarkus, a ClassNotFoundException is thrown if the service is run in development mode. With the uber-jar, it works correctly.
How can I get the service working in development mode too?
The missing class belongs to a transitive dependency of a QR bill generator library, which is declared build.gradle:
dependencies {
...
implementation 'net.codecrete.qrbill:qrbill-generator:2.2.2'
...
}
The error occurs in development mode (gradle quarkusDev) only. It is triggered if a REST request would need to use the qrbill:qrbill-generator library:
2020-05-03 12:11:49,463 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /xxx/yyy failed, error id: 89c5b7f8-c762-4f7f-959b-67f16b2bc120-1: org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: io/nayuki/qrcodegen/QrCode$Ecc
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:216)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:515)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
[several lines omitted]
Caused by: java.lang.NoClassDefFoundError: io/nayuki/qrcodegen/QrCode$Ecc
at net.codecrete.qrbill.generator.QRCode.draw(QRCode.java:49)
at net.codecrete.qrbill.generator.BillLayout.drawPaymentPart(BillLayout.java:131)
at net.codecrete.qrbill.generator.BillLayout.draw(BillLayout.java:94)
[several lines omitted]
Caused by: java.lang.ClassNotFoundException: io.nayuki.qrcodegen.QrCode$Ecc
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:341)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:294)
... 44 more
When analyzing the dependencies, I can see that io.nayuki:qrcodegen:1.6.0 is part of the runtimeClasspath but not part of the compileClasspath. This looks ok.
Could it be that Quarkus dev mode uses the wrong classpath?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil

I am using following version of corda -
buildscript {
ext.corda_release_version = '2.0.0'
ext.corda_gradle_plugins_version = '1.0.0'
I am using following version of spring boot web server -
buildscript {
ext.spring_boot_version = '1.5.7.RELEASE'
ext.spring_version = '4.3.11.RELEASE'
}
I am using following version of log4j -
dependencies {
compile "org.apache.logging.log4j:log4j-web:2.7"
Following error is thrown while compiling -
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/ReflectionUtil
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:42)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:273)
at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:179)
at net.corda.server.ServerKt.main(Server.kt:29)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.ReflectionUtil
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more
Expecting insights.
Thanks in advance.
You are using a version of log4j that is conflicting with Springs own dependency on the library. Try removing your log4j dependency and rely on the one Spring is bringing in.
The log4j dep is probably a lower version than what spring wants, hence the NoClassDefFoundError.

Google Api Calendar and Spring Boot not working because of dependencies

I am trying to use the Google Api for Calendar (https://developers.google.com/calendar/quickstart/java) but, when I include the dependencies in my spring boot project I get an error.
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ~[tomcat-embed-core-8.5.28.jar:8.5.28]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) ~[tomcat-embed-core-8.5.28.jar:8.5.28]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[tomcat-embed-core-8.5.28.jar:8.5.28]
... 15 common frames omitted
It looks like it is related to the fact that google api uses Jetty.
These are my build.gradle dependencies:
dependencies {
compile "com.google.api-client:google-api-client:1.23.0"
compile 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
compile 'com.google.apis:google-api-services-calendar:v3-rev305-1.23.0'
compile 'javax.persistence:javax.persistence-api:2.2'
compile 'javax.inject:javax.inject:1'
compile 'javax.validation:validation-api:2.0.1.Final'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
compile 'com.h2database:h2'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
gradleLint.ignore('unused-dependency') {
compileOnly 'org.projectlombok:lombok:1.16.20'
}
}

Spring boot run error

The project spring boot 1..5.7 release. I am using Intellij IDEA 2017.2.4 and gradle for dependency management. When i build the project it builds successfully with no error. When I run the application with bootRun gradle task it shows the following error.
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.boot.SpringApplicationRunListener : org.springframework.boot.context.event.EventPublishingRunListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:413)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:392)
at org.springframework.boot.SpringApplication.getRunListeners(SpringApplication.java:378)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:291)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.kifiya.lmanagement.LmanagementApplication.main(LmanagementApplication.java:13)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.event.EventPublishingRunListener]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget(Ljava/lang/Object;)Ljava/lang/Object;
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:409)
... 6 more
Caused by: java.lang.NoSuchMethodError: org.springframework.aop.framework.AopProxyUtils.getSingletonTarget(Ljava/lang/Object;)Ljava/lang/Object;
at org.springframework.context.event.AbstractApplicationEventMulticaster.addApplicationListener(AbstractApplicationEventMulticaster.java:105)
at org.springframework.boot.context.event.EventPublishingRunListener.(EventPublishingRunListener.java:56)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
... 7 more
It seems like a dependency problem within Spring, as it's mentioned above. The easiest way IMHO is to check your POM file.
Check out here for more info: https://docs.gradle.org/current/userguide/introduction_dependency_management.html
It looks like spring-aop doesn't match the rest of your libraries. Try running gradle dependencies and check that all Spring dependencies are in the same version. More on inspecting dependencies in Gradle User Manual.
Old question, but I had the same error after converting a Spring application to Spring Boot. Using the spring-boot-starter-aop instead of a direct dependency on a specific version of spring-aop resolved it for me, e.g. in build.gradle:
plugins {
id 'org.springframework.boot' version '1.5.17.RELEASE'
}
apply plugin: 'io.spring.dependency-management'
dependencies {
compile 'org.springframework.boot:spring-boot-starter-aop'
}
instead of
dependencies {
compile 'org.springframework:spring-aop:4.2.4.RELEASE'
}

Resources