可能是版本號不對應(我是用的springboot版本是2.2.1.RELEASE),在使用
<dependency> <groupId>de.javakaffee</groupId> <artifactId>kryo-serializers</artifactId> <version>0.45</version> </dependency>
的時候服務提供者和消費者必須增加以下依賴:
<dependency> <groupId>com.esotericsoftware</groupId> <artifactId>kryo</artifactId> <version>4.0.2</version> </dependency>
否則會報錯:
Caused by: com.alibaba.dubbo.remoting.RemotingException: Failed to send message Request Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.alibaba.dubbo.common.serialize.kryo.utils.KryoUtils