apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.48k stars 26.43k forks source link

Received inconsistent serialization type from client, reject to deserialize! Expected:hessian2 Actual:xxx #9790

Closed luger1990 closed 2 years ago

luger1990 commented 2 years ago

使用spring boot + dubbo3 + triple协议,消费者端调用报错: Received inconsistent serialization type from client, reject to deserialize! Expected:hessian2 Actual:

provider端配置如下:

server:
  port: 8881
spring:
  application:
    name: dubbo-grpc-provider
  profiles:
    active: dev
  main:
    allow-bean-definition-overriding: true
dubbo:
  application:
    name: ${spring.application.name}
    id: ${spring.application.name}
    register-mode: instance
  registry:
    address: nacos://127.0.0.1:8848
  scan:
    base-packages: me.luger
  protocol:
    name: tri
    port: 20880
    accesslog: true
  monitor:
    protocol: registry

consumer端配置如下:

server:
  port: 8882
spring:
  application:
    name: dubbo-grpc-consumer
  profiles:
    active: dev
  main:
    allow-bean-definition-overriding: true
dubbo:
  application:
    name: ${spring.application.name}
    id: ${spring.application.name}
    register-mode: instance
  registry:
    address: nacos://127.0.0.1:8848
  cloud:
    subscribed-services: dubbo-grpc-provider
  consumer:
    timeout: 3000

详细报错如下:

org.apache.dubbo.rpc.RpcException: Received inconsistent serialization type from client, reject to deserialize! Expected:hessian2 Actual:taylor at org.apache.dubbo.rpc.protocol.tri.AbstractClientStream.getThrowableFromTrailers(AbstractClientStream.java:188) ~[dubbo-3.0.6.jar:3.0.6] at org.apache.dubbo.rpc.protocol.tri.UnaryClientStream$ClientUnaryInboundTransportObserver.onError(UnaryClientStream.java:86) ~[dubbo-3.0.6.jar:3.0.6] at org.apache.dubbo.rpc.protocol.tri.UnaryClientStream$ClientUnaryInboundTransportObserver.lambda$onComplete$0(UnaryClientStream.java:56) ~[dubbo-3.0.6.jar:3.0.6] at org.apache.dubbo.common.threadpool.serial.SerializingExecutor.run(SerializingExecutor.java:99) ~[dubbo-3.0.6.jar:3.0.6] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_191] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_191] at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41) ~[dubbo-3.0.6.jar:3.0.6] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191]

ps:还有个问题,为什么消费者和提供者都启动之后再nacos中只有生产者中可以看到数据。如下图 image image

vio-lin commented 2 years ago

是不是ip一样然后服务端重启了。因为客户端有段逻辑会缓存以前链接过的client 我记得有版本会把这个url给缓存起来。 按着ip+端口 缓存一个url。 我们遇到过然后把不同序列化格式服务开在不同的端口上。

guohao commented 2 years ago

看起来是读取了header 里的序列化方式,尝试下 3.0.7-SNAPSHOT 版本