Issue on building with GraalVM native image - Discovered unresolved type during parsing: io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger

I am using Quarkus and trying to build the native image and got this error
My dependecies

dependencies {
    implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
    implementation("io.quarkus:quarkus-kotlin")
    implementation("io.quarkus:quarkus-kubernetes")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("io.quarkus:quarkus-arc")
    testImplementation("io.quarkus:quarkus-junit5")
    implementation("io.temporal:temporal-sdk:1.21.0")
}

Error

Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger. This error is reported at image build time because class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2LoggerFactory is registered for linking at image build time by command line
at parsing io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2LoggerFactory.newInstance(Log4J2LoggerFactory.java:33)
at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2536)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:169)

Hello @Gireesh_Kumar

I’m not a Quarkus expert, but it seems like this issue is common. I found a possible solution posted here (though I haven’t tested it).

Let us know how it goes,

Antonio

Hi @antonio.perez

Thanks, tried like below, but no effect

quarkusBuild {
nativeArgs {
containerBuild = true
linkAtBuildTime = true
}
}

but not sure, how to provide this in my gradle with Kotlin script. I wanted to test with my original project which is in Kotlin to make sure it worked. Any thougths ?

I tried it like this as well, but no luck

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true -Dquarkus.native.additional-build-args=–link-at-build-time

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true -Dquarkus.native.additional-build-args=–link-at-build-time=io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger

Tried with differnet combination, finally adding these dependencies helped to resolve the issue, without the additional params, –link-at-build-time is not required.

implementation("org.jboss.logging:commons-logging-jboss-logging")
implementation("org.jboss.logmanager:log4j-jboss-logmanager")
implementation("org.jboss.slf4j:slf4j-jboss-logmanager")
implementation("org.jboss.logmanager:log4j2-jboss-logmanager")
1 Like