You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Tsz Wo Nicholas Sze (JIRA)" <ji...@apache.org> on 2018/05/09 22:08:00 UTC
[jira] [Comment Edited] (RATIS-237) Multiple definition of
io.opencensus.trace.unsafe.ContextUtils is resolved as dependency causing
runtime issue
[ https://issues.apache.org/jira/browse/RATIS-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16469574#comment-16469574 ]
Tsz Wo Nicholas Sze edited comment on RATIS-237 at 5/9/18 10:07 PM:
--------------------------------------------------------------------
Indeed, jctools dependency is set incorrectly -- It should only be set in ratis-proto-shaded but not in other projects including ratis-grpc, ratis-netty and Ozone.
{code}
Exception in thread "Datanode State Machine Thread - 0" java.lang.NoClassDefFoundError: org/jctools/queues/MpscUnboundedArrayQueue
{code}
This exception was due to wrong version of jctools in Ozone. Ratis is updated to 2.1.2 but Ozone is still using 1.2.1. In hadoop-project/pom.xml, we should remove the jctools dependency.
I have tested the new patch with Ozone. It no long has java.lang.NoClassDefFoundError.
r237_20180509b.patch
was (Author: szetszwo):
Indeed, jctools dependency is set incorrectly -- It should only be set in ratis-proto-shaded but not in other projects including ratis-grpc, ratis-netty and Ozone.
{code}
Exception in thread "Datanode State Machine Thread - 0" java.lang.NoClassDefFoundError: org/jctools/queues/MpscUnboundedArrayQueue
{code}
This exception was due to wrong version of jctools in Ozone. In hadoop-project/pom.xml, we should remove the jctools dependency.
I have tested the new patch with Ozone. It no long has java.lang.NoClassDefFoundError.
r237_20180509b.patch
> 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_20180509b.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)