Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-9320

NoSuchMethodError When Configuring camel-zipkin in Spring XML DSL with Managed Dependencies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • fuse-7.2
    • fuse-7.0, fuse-7.0.1
    • Camel
    • None
    • % %
    • Hide

      Reproducer attached.

      1. Download and set up a zipkin server on localhost (I just used the jar distro from github)
      2. Build and run the attached springboot example with as-is pom.xml
      3. Observe the logging for the NoSuchMethodError described above
      4. Stop the example app and uncomment the exclusions under the camel-zipkin dependency and the explicit inclusion of zipkin 2.4.5
      5. Rebuild the app and run
      6. Now spans are correctly reported

      (Note this also was encountered when configuring the deprecated collector vs. reporter component)

      Show
      Reproducer attached. 1. Download and set up a zipkin server on localhost (I just used the jar distro from github) 2. Build and run the attached springboot example with as-is pom.xml 3. Observe the logging for the NoSuchMethodError described above 4. Stop the example app and uncomment the exclusions under the camel-zipkin dependency and the explicit inclusion of zipkin 2.4.5 5. Rebuild the app and run 6. Now spans are correctly reported (Note this also was encountered when configuring the deprecated collector vs. reporter component)

      When configuring the camel-zipkin components via Spring DSL as indicated in the documented example:

        <!-- configure how to reporter spans to a Zipkin collector
                (the dependency is io.zipkin.reporter2:zipkin-reporter-spring-beans) -->
        <bean id="http" class="zipkin2.reporter.beans.AsyncReporterFactoryBean">
          <property name="sender">
            <bean id="sender" class="zipkin2.reporter.beans.OkHttpSenderFactoryBean">
              <property name="endpoint" value="http://localhost:9411/api/v2/spans"/>
            </bean>
          </property>
          <!-- wait up to half a second for any in-flight spans on close -->
          <property name="closeTimeout" value="500"/>
        </bean>
      
        <!-- setup zipkin tracer -->
        <bean id="zipkinTracer" class="org.apache.camel.zipkin.ZipkinTracer">
          <property name="serviceName" value="dude"/>
          <property name="spanReporter" ref="http"/>
        </bean>
      

      a NoSuchMethodError is encountered when trying to report the span to the configured server:

      java.lang.NoSuchMethodError: zipkin.Span.traceIdString()Ljava/lang/String;
      	at com.github.kristofa.brave.internal.V2SpanConverter.newBuilder(V2SpanConverter.java:309)
      	at com.github.kristofa.brave.internal.V2SpanConverter$Builders.<init>(V2SpanConverter.java:48)
      	at com.github.kristofa.brave.internal.V2SpanConverter.fromSpan(V2SpanConverter.java:34)
      	at com.github.kristofa.brave.Recorder$Default.flush(Recorder.java:104)
      	at com.github.kristofa.brave.Recorder$Default.finish(Recorder.java:86)
      	at com.github.kristofa.brave.AnnotationSubmitter.submitEndAnnotation(AnnotationSubmitter.java:87)
      	at com.github.kristofa.brave.ServerTracer.setServerSend(ServerTracer.java:217)
      	at com.github.kristofa.brave.ServerResponseInterceptor.handle(ServerResponseInterceptor.java:35)
      	at org.apache.camel.zipkin.ZipkinTracer.serverResponse(ZipkinTracer.java:676)
      	at org.apache.camel.zipkin.ZipkinTracer.access$700(ZipkinTracer.java:103)
      	at org.apache.camel.zipkin.ZipkinTracer$ZipkinRoutePolicy$1.onAfterRoute(ZipkinTracer.java:769)
      	at org.apache.camel.util.UnitOfWorkHelper.afterRouteSynchronizations(UnitOfWorkHelper.java:154)
      	at org.apache.camel.impl.DefaultUnitOfWork.afterRoute(DefaultUnitOfWork.java:287)
      	at org.apache.camel.processor.CamelInternalProcessor$RouteLifecycleAdvice.after(CamelInternalProcessor.java:322)
      	at org.apache.camel.processor.CamelInternalProcessor$InternalCallback.done(CamelInternalProcessor.java:251)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:127)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:205)
      	at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:78)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
      	at org.eclipse.jetty.servlets.MultiPartFilter.doFilter(MultiPartFilter.java:150)
      	at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:43)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:531)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)
      	at java.lang.Thread.run(Thread.java:748)
      

      This appears to be due to the inclusion of the older io.zipkin.java/zipkin1.19.2 dependency, which does not have a method signature matching the one requested by the brave V2SpanConverter.

      Exclusion of the 1.19.2 dependency and explicit inclusion of a later version (Iused 2.4.5) seems to resolve the issue and spans are correctly reported.

            acosenti Andrea Cosentino
            rhn-support-dhawkins Duane Hawkins
            Jan Bouska Jan Bouska
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: