Quarkus: RestClient with opentracing native build error(with gradle)

Created on 27 Nov 2019  路  4Comments  路  Source: quarkusio/quarkus

Describe the bug
I add implementation 'io.quarkus:quarkus-smallrye-opentracing' into build.gradle.
I have client class with name UserServiceClient.java.
When I remove the client class it successfully build.

You can examine the repository: https://github.com/berkyvz/quarkus-issues/tree/master/opentracing-quickstart

__UserServiceClient.java__

@RegisterRestClient
public interface UserServiceClient {
   @GET
   @Path("/user")
   String user();
}

Expected behavior
./gradlew clean buildNative should not failed.

Actual behavior
After running buildNative command the logs;

Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.opentracing.contrib.tracerresolver.TracerResolver. 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.opentracing.contrib.interceptors.OpenTracingInterceptor.getTracer(OpenTracingInterceptor.java:106)
Call path from entry point to io.opentracing.contrib.interceptors.OpenTracingInterceptor.getTracer(): 
        at io.opentracing.contrib.interceptors.OpenTracingInterceptor.getTracer(OpenTracingInterceptor.java:102)
        at io.opentracing.contrib.interceptors.OpenTracingInterceptor.wrap(OpenTracingInterceptor.java:43)
        at io.opentracing.contrib.interceptors.OpenTracingInterceptor_Bean.intercept(OpenTracingInterceptor_Bean.zig:393)
        at org.jboss.resteasy.microprofile.client.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:164)
        at org.jboss.resteasy.microprofile.client.InvocationContextImpl.invokeNext(InvocationContextImpl.java:67)
        at org.jboss.resteasy.microprofile.client.InvocationContextImpl.proceed(InvocationContextImpl.java:99)
        at org.jboss.resteasy.microprofile.client.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:160)
        at com.sun.proxy.$Proxy192.hashCode(Unknown Source)
        at java.util.HashMap.hash(HashMap.java:339)
        at java.util.HashMap.get(HashMap.java:557)
        at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
        at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)

Configuration

quarkus.jaeger.service-name=card-service
quarkus.jaeger.sampler-type=const
quarkus.jaeger.sampler-param=1

Environment (please complete the following information):

  • Output of uname -a or ver: Linux berk-yavuz 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version "1.8.0_232"
  • GraalVM version (if different from Java): OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode)
  • Quarkus version or git rev: 1.0.0.Final
kinbug

All 4 comments

@machi1990 any chance you could have a look to that one? I think we should first try to see if we can reproduce the issue with Maven to check if it's a global issue or something specific to Gradle (as we have some class loader issues specific to Gradle, we need to be cautious).

Hi, we( work together with issuer ) have tested it with maven, it seems working with maven

@gsmet @muratkarakas @berkyvz Indeed, with maven it works.

Here is what I observed with gradle:

When I added the traceresolver dependency i.e

implementation 'io.opentracing.contrib:opentracing-tracerresolver:0.1.5'

in the build.gradle file, I was able to build the native executable i.e with ./gradlew buildNative -x test command.

build output:


> Task :quarkusBuild
building quarkus runner
These dependencies are not recommended:
        - javax.enterprise:cdi-api should be replaced by jakarta.enterprise:jakarta.enterprise.cdi-api
        - javax.inject:javax.inject should be replaced by jakarta.inject:jakarta.inject-api
        - org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec should be replaced by jakarta.interceptor:jakarta.interceptor-api
You might end up with two different versions of the same classes or with an artifact you shouldn't have in your classpath.

> Task :buildNative
building native image
These dependencies are not recommended:
        - javax.enterprise:cdi-api should be replaced by jakarta.enterprise:jakarta.enterprise.cdi-api
        - javax.inject:javax.inject should be replaced by jakarta.inject:jakarta.inject-api
        - org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.2_spec should be replaced by jakarta.interceptor:jakarta.interceptor-api
You might end up with two different versions of the same classes or with an artifact you shouldn't have in your classpath.

BUILD SUCCESSFUL in 2m 14s
5 actionable tasks: 2 executed, 3 up-to-date

running the executable:

./build/opentracing-quickstart-1.0-SNAPSHOT-runner 

2019-11-28 10:28:39,118 INFO  [io.quarkus] (main) opentracing-quickstart 1.0-SNAPSHOT (running on Quarkus 1.0.0.Final) started in 0.017s. Listening on: http://0.0.0.0:8080
2019-11-28 10:28:39,119 INFO  [io.quarkus] (main) Profile prod activated. 
2019-11-28 10:28:39,119 INFO  [io.quarkus] (main) Installed features: [cdi, jaeger, rest-client, resteasy, resteasy-jsonb, smallrye-opentracing]

What I am unable to understand though is why the JVM mode works without adding the dependency line? Is this the class loading issue @gsmet mentioned?

/cc @geoand @gastaldi for gradle input

This is probably a stupid question, but where does quarkus-smallrye-opentracing come from? Isn't quarkus-jaeger the supported tracing dependency?

Was this page helpful?
0 / 5 - 0 ratings