Pre-check

  • [x] I am sure that all the content I provide is in English.

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

org.apache.dubbo:dubbo:3.3.4 org.apache.dubbo:dubbo-spring-boot:3.3.4 javac 21.0.6

Steps to reproduce this issue

The same problem occurs when configuring Zipkin tracing, mainly in the context switching of webflux.

org.apache.dubbo.spring.boot.autoconfigure.observability.DubboMicrometerTracingAutoConfiguration#dubboServerTracingObservationHandler

As long as the above bean is registered, the Webflux context switching will fail.

No need to configure any link tracking, just turn on the tracking switch.

What you expected to happen

2025-05-02T15:58:59.842Z DEBUG 28890 --- [io-42010-exec-1] [ ] o.s.w.s.a.HttpWebHandlerAdapter : [7a06cd92] HTTP POST "/graphql" 2025-05-02T15:58:59.861Z TRACE 28890 --- [io-42010-exec-1] [b3e0cb9fb1d6e22ac63ef6ce27a5e30a-1ca5e0e0cdfadcc1] o.s.h.s.r.ServletHttpHandlerAdapter : [7a06cd92] onError: java.lang.ClassCastException: class org.springframework.http.server.reactive.observation.ServerRequestObservationContext cannot be cast to class org.apache.dubbo.tracing.context.DubboServerContext (org.springframework.http.server.reactive.observation.ServerRequestObservationContext and org.apache.dubbo.tracing.context.DubboServerContext are in unnamed module of loader 'app') 2025-05-02T15:58:59.861Z TRACE 28890 --- [io-42010-exec-1] [b3e0cb9fb1d6e22ac63ef6ce27a5e30a-1ca5e0e0cdfadcc1] o.s.h.s.r.ServletHttpHandlerAdapter : [7a06cd92] Setting ServletResponse status to 500 Server Error

Anything else

application.yaml

spring:
  application:
    name: gateway-admin
  main:
    web-application-type: reactive
  config:
    import:
      - 'optional:classpath:application-base.yml'
      - 'optional:classpath:application-common.yml'
      - 'optional:classpath:application-self.yml'
      - 'optional:classpath:application-${spring.profiles.active}-common.yml'
      - 'optional:classpath:application-${spring.profiles.active}.yml'
      - 'optional:zookeeper:'
  profiles:
    active: ${APP_PROFILE:local}

application-base.yaml

spring:
  main:
    banner-mode: off
  reactor:
    context-propagation: auto
  cloud:
    zookeeper:
      connect-string: ${APP_ZOOKEEPER_CONNECT_STRING:localhost:2181}
  graphql:
    graphiql:
      enabled: true
    websocket:
      path: /graphql
  redis:
    redisson:
      config: |
        clusterServersConfig:
          nodeAddresses:
            - "valkey://127.0.0.1:7000"
          checkSlotsCoverage: true
          connectTimeout: 30000
          subscriptionsPerConnection: 5
        threads: 16
        nettyThreads: 32
        transportMode: "NIO"
dgs:
  graphql:
    dgs-response-headers:
      enabled: false

dubbo:
  application:
    name: dubbo-${spring.application.name}
    logger: slf4j
    enable-empty-protection: true
    enable-file-cache: false
    qos-enable: false
    register-mode: instance
    preferred-protocol: tri
    auto-trust-serialize-class: true
    trust-serialize-class-level: 10
    serialize-check-status: DISABLE
    check-serializable: false
  protocol:
    name: tri
    port: -1
    timeout: 20000
    serialization: fastjson2
    triple:
      rest:
        json-framework: fastjson2
  consumer:
    check: false
    timeout: 20000
    serialization: fastjson2
  provider:
    check: false
    timeout: 20000
    serialization: fastjson2
  registry:
    address: zookeeper://${spring.cloud.zookeeper.connect-string}
  config-center:
    address: ${dubbo.registry.address}
  metadata-report:
    address: ${dubbo.registry.address}
  metrics:
    aggregation:
      enabled: true
    histogram:
      enabled: true
  tracing:
    propagation:
      type: W3C
    tracing-exporter:
      zipkin-config:
        connect-timeout: 1s
        read-timeout: 10s
        endpoint: http://127.0.0.1:9411/api/v2/spans
    sampling:
      probability: 1
    enabled: true

management:
  tracing:
    sampling:
      probability: 1.0
  zipkin:
    tracing:
      export:
        enabled: true
      endpoint: http://127.0.0.1:9411/api/v2/spans

server:
  port: 0
  shutdown: graceful

lifecycle:
  timeout-per-shutdown-phase: 20s

logging:
  include-application-name: false
  level:
    root: INFO
    org.springframework.boot.context.config: DEBUG
    org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR
    org.apache.dubbo.spring.boot.context.event.WelcomeLogoApplicationListener: INFO
    org.springframework.http.server.reactive: TRACE

sa-token:
  is-print: false
  check-same-token: true
  log-level: DEBUG
  is-log: true

debug: true

dependencies

https://app.warp.dev/block/MzKkXxfm1KRR8UC3jNnNME

Are you willing to submit a pull request to fix on your own?

  • [ ] Yes I am willing to submit a pull request on my own!

Code of Conduct

Comment From: AlbumenJ

@oxsean PTAL

Comment From: heliang666s

I will solve this problem~