Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

按照官网给出的配置,kryo序列化在consumer会报错 #201

Open
soiz-tor opened this issue Mar 6, 2023 · 2 comments
Open

按照官网给出的配置,kryo序列化在consumer会报错 #201

soiz-tor opened this issue Mar 6, 2023 · 2 comments

Comments

@soiz-tor
Copy link

soiz-tor commented Mar 6, 2023

官网kryo序列化配置链接:https://dubbo.apache.org/zh-cn/overview/what/ecosystem/serialization/kryo/

环境:
jdk:19
dubbo:3.2.0-beta.5
spring boot:3.0.4

在consumer添加了对应依赖后,并设置了dubbo.protocol.serialization=kryo,consumer启动报错
报错信息:

Caused by: org.apache.dubbo.remoting.RemotingException: Failed to send message Request [id=5, version=2.0.2, twoWay=true, event=false, broken=false, data=null] to /192.168.189.1:20880, cause: com/esotericsoftware/kryo/pool/KryoFactory
	at org.apache.dubbo.remoting.transport.netty4.NettyChannel.send(NettyChannel.java:226) ~[dubbo-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.remoting.transport.AbstractClient.send(AbstractClient.java:202) ~[dubbo-remoting-api-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:53) ~[dubbo-remoting-api-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.request(HeaderExchangeChannel.java:136) ~[dubbo-remoting-api-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeClient.request(HeaderExchangeClient.java:100) ~[dubbo-remoting-api-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:109) ~[dubbo-3.2.0-beta.5.jar:3.2.0-beta.5]
	... 22 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/esotericsoftware/kryo/pool/KryoFactory
	at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013) ~[na:na]
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[na:na]
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) ~[na:na]
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) ~[na:na]
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) ~[na:na]
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
	at org.apache.dubbo.common.serialize.kryo.KryoObjectOutput.<init>(KryoObjectOutput.java:39) ~[dubbo-serialization-kryo-2.7.22.jar:2.7.22]
	at org.apache.dubbo.common.serialize.kryo.KryoSerialization.serialize(KryoSerialization.java:51) ~[dubbo-serialization-kryo-2.7.22.jar:2.7.22]
	at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:257) ~[dubbo-remoting-api-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:75) ~[dubbo-remoting-api-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:53) ~[dubbo-3.2.0-beta.5.jar:3.2.0-beta.5]
	at org.apache.dubbo.remoting.transport.netty4.NettyChannel.send(NettyChannel.java:192) ~[dubbo-3.2.0-beta.5.jar:3.2.0-beta.5]
	... 27 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.esotericsoftware.kryo.pool.KryoFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
	... 42 common frames omitted
@EarthChen
Copy link
Member

在 spi 中找一下kryo 的依赖,第三方序列化不包含在 dubbo 主依赖中

@AlbumenJ
Copy link
Member

这个应该和 kryo4 kryo5 的版本差异有关系

@AlbumenJ AlbumenJ transferred this issue from apache/dubbo Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants