Spring Sleuth + Zuul = java.lang.IllegalArgumentException:格式错误的id

时间:2017-11-02 12:37:06

标签: spring-cloud-netflix spring-cloud-sleuth

我们正在使用 spring-cloud-sleuth spring-cloud-zuul

在上述情况下,当HTTP请求从 Spring Zuul 转发到下一个微服务X然后在X上,我们得到以下错误:

java.lang.IllegalArgumentException: Malformed id: 6103370e80268685, 6103370e80268685
        at org.springframework.cloud.sleuth.Span.hexToId(Span.java:602)
        at org.springframework.cloud.sleuth.instrument.web.ZipkinHttpSpanExtractor.spanId(ZipkinHttpSpanExtractor.java:86)
        at org.springframework.cloud.sleuth.instrument.web.ZipkinHttpSpanExtractor.joinTrace(ZipkinHttpSpanExtractor.java:51)
        at org.springframework.cloud.sleuth.instrument.web.ZipkinHttpSpanExtractor.joinTrace(ZipkinHttpSpanExtractor.java:20)
        at org.springframework.cloud.sleuth.instrument.web.TraceFilter.createSpan(TraceFilter.java:373)
        at org.springframework.cloud.sleuth.instrument.web.TraceFilter.doFilter(TraceFilter.java:185)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
        at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:486)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)

为什么会发生仅当我们将来自ZUUL的消息转发给其他微服务但在我们系统中的其他微服务之间的通信中不会发生 / p>

1 个答案:

答案 0 :(得分:1)

已经修复了bug

但功能不起作用:

<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.SR4</version>

作为临时解决方案,您可以在ZUUL上关闭它直到下一个版本:

spring.sleuth.zuul.enabled: false