I don't see patch attached. Please create RATIS JIRA and attach there.
Thanks On Mon, May 7, 2018 at 10:24 AM, Nandakumar Vadivelu < nvadiv...@hortonworks.com> wrote: > Hi All, > > Below is the exception which we get with Ratis 0.2.0 > > java.lang.NoSuchFieldError: CONTEXT_SPAN_KEY > at org.apache.ratis.shaded.io.grpc.internal.CensusTracingModule$ > ServerTracer.filterContext(CensusTracingModule.java:340) > at org.apache.ratis.shaded.io.grpc.internal.StatsTraceContext. > serverFilterContext(StatsTraceContext.java:121) > at org.apache.ratis.shaded.io.grpc.internal.ServerImpl$ > ServerTransportListenerImpl.createContext(ServerImpl.java:482) > at org.apache.ratis.shaded.io.grpc.internal.ServerImpl$ > ServerTransportListenerImpl.streamCreated(ServerImpl.java:416) > <stack trace truncated> > > > The problem is because of two different definition of > io.opencensus.trace.unsafe.ContextUtils class present in the classpath. > 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 > > 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"); > } > > > Since we have added io.opencensus as direct dependency in ratis-grpc we > get the below definition in io.opencensus:opencensus-api:jar > > 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"); > } > > Both of the jars end up in classpath and ContextUtils is getting loaded > from io.opencensus:opencensus-api:jar which is causing the problem. > > The simple fix would be to remove the dependency of io.opencensus from > ratis-grpc/pom.xml (patch for the same is attached in this mail). This is > not a permanent fix, as any application might bring in > io.opencensus:opencensus-api:jar of its own. > > We have to find a way to shade io.opencensus:opencensus-api:jar. > > Note: from the comment in ratis-proto-shaded/pom.xml: Cannot relocate > io.opencensus due to AutoValue code generation > > > -Nanda > > On 5/7/18, 3:28 PM, "Lokesh Jain" <lj...@hortonworks.com> wrote: > > We found an issue while updating ozone to Ratis snapshot build > 0.1.1-alpha-4309324-SNAPSHOT (https://issues.apache.org/ > jira/browse/HDDS-19). I feel we should hold the release till this is > fixed. Please let us know of your opinion as well. > > Thanks > Lokesh > > > >