[ https://issues.apache.org/jira/browse/RATIS-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16467979#comment-16467979 ]
Elek, Marton commented on RATIS-237: ------------------------------------ [~szetszwo] Slightly off topic but I checked: Jenkins sorts the available patches and will use the last one in alphabetical order (https://github.com/apache/yetus/blob/e56ba299c1cd0f79579986ebd37cf57376add710/precommit/jenkins/jenkins-admin.py#L85). So the problem was the different naming schema. > Multiple definition of io.opencensus.trace.unsafe.ContextUtils is resolved as > dependency causing runtime issue > -------------------------------------------------------------------------------------------------------------- > > Key: RATIS-237 > URL: https://issues.apache.org/jira/browse/RATIS-237 > Project: Ratis > Issue Type: Bug > Reporter: Nanda kumar > Assignee: Tsz Wo Nicholas Sze > Priority: Major > Attachments: r237_20180508.patch > > > Two different definitions of {{io.opencensus.trace.unsafe.ContextUtils}} is > resolved and added to the runtime classpath of Ratis. The reason for having > two different definition of {{ContextUtils}} in classpath is due to the fact > that we are shading/relocating io.grpc and not {{io.opencensus}}. > With shading, we are generating the below definition which ends up in > ratis-proto-shaded jar > {code} > package io.opencensus.trace.unsafe; > import org.apache.ratis.shaded.io.grpc.Context; > import io.opencensus.trace.Span; > /** > * Util methods/functionality to interact with the {@link > org.apache.ratis.shaded.io.grpc.Context}. > * > * <p>Users must interact with the current Context via the public APIs in > {@link > * io.opencensus.trace.Tracer} and avoid usages of the {@link > #CONTEXT_SPAN_KEY} directly. > * > * @since 0.5 > */ > public final class ContextUtils { > // No instance of this class. > private ContextUtils() {} > /** > * The {@link org.apache.ratis.shaded.io.grpc.Context.Key} used to interact > with {@link org.apache.ratis.shaded.io.grpc.Context}. > * > * @since 0.5 > */ > public static final Context.Key<Span> CONTEXT_SPAN_KEY = > Context.key("opencensus-trace-span-key"); > } > {code} > Since we have added {{io.opencensus}} as direct dependency in ratis-grpc we > get the below definition in {{io.opencensus:opencensus-api:jar}} > {code} > package io.opencensus.trace.unsafe; > import io.grpc.Context; > import io.opencensus.trace.Span; > /** > * Util methods/functionality to interact with the {@link io.grpc.Context}. > * > * <p>Users must interact with the current Context via the public APIs in > {@link > * io.opencensus.trace.Tracer} and avoid usages of the {@link > #CONTEXT_SPAN_KEY} directly. > * > * @since 0.5 > */ > public final class ContextUtils { > // No instance of this class. > private ContextUtils() {} > /** > * The {@link io.grpc.Context.Key} used to interact with {@link > io.grpc.Context}. > * > * @since 0.5 > */ > public static final Context.Key<Span> CONTEXT_SPAN_KEY = > Context.key("opencensus-trace-span-key"); > } > {code} > Both of the jars end up in classpath and {{ContextUtils}} is getting loaded > from {{io.opencensus:opencensus-api:jar}} which is causing problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)