Open CoCoYuYuan opened 1 year ago
我也观察了dubbo内的文档,可是只是提到了要security/serialize.allowlist 资源文件中声明您所使用的类名,Dubbo 将自动将其加载到安全列表中这么操作,没具体演示应该怎么弄,所以我很困惑
在resources 目录下创建 security/serialize.allowlist 文件,将你需要序列化的类填进去
我尝试了几种文件创建如: 如: 如:
重新启动后还是一样的错误,文件里面的值我填充的是 com.lc.entity.TestInfo 请告知该如何弄,这让我很困惑
在resources 目录下创建 security/serialize.allowlist 文件,将你需要序列化的类填进去
添加了 可是还是提示一样错误,是我的依赖没有给对吗?我已经被这个东西弄晕了
或者有没有demo解决了这个问题的,我去参考解决下
resource/security/serialize.allowlist 这样吧。。 resource 下新建一个文件夹security 然后在 security 文件夹下新建 serialize.allowlist文件
我重新的创建了一下这些文件 如果是这样的话那似乎没生效?
你的日志里 有这个开头的么 。。Read serialize allow list from
你的日志里 有这个开头的么 。。
Read serialize allow list from
有的,启动完成后共有6处以Read serialize allow list from
开头的数据,
2023-04-04 22:11:15.528 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from file:/E:/workspace/new/cloud-immigrant/lc-consumer/lc-consumer-mobileProgram/target/classes/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50
2023-04-04 22:11:15.529 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from jar:file:/E:/development/Maven/newmaven/org/apache/dubbo/dubbo/3.1.8/dubbo-3.1.8.jar!/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50
2023-04-04 22:11:15.588 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from file:/E:/workspace/new/cloud-immigrant/lc-consumer/lc-consumer-mobileProgram/target/classes/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50 2023-04-04 22:11:15.588 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from jar:file:/E:/development/Maven/newmaven/org/apache/dubbo/dubbo/3.1.8/dubbo-3.1.8.jar!/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50
2023-04-04 22:11:15.598 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from file:/E:/workspace/new/cloud-immigrant/lc-consumer/lc-consumer-mobileProgram/target/classes/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50 2023-04-04 22:11:15.598 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from jar:file:/E:/development/Maven/newmaven/org/apache/dubbo/dubbo/3.1.8/dubbo-3.1.8.jar!/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50
这么看上去是生效了的,不过我不清楚为什么还会报错
2023-04-04 22:11:15.528 INFO 19992 --- [ main] o.a.d.c.u.SerializeSecurityConfigurator : [DUBBO] Read serialize allow list from file:/E:/workspace/new/cloud-immigrant/lc-consumer/lc-consumer-mobileProgram/target/classes/security/serialize.allowlist, dubbo version: 3.1.8, current host: 192.168.31.50
3.1.x 版本的序列化校验不会导致调用报错的,麻烦把具体报错栈给贴一下
@AlbumenJ 同求,这个问题怎么解决?我3.2.2 还存在这个问题。 原因是我用了父类,子类,然后子类就反序列化不回来了,报不安全
参考这个https://github.com/apache/dubbo/issues/13381,建议添加java参数-Ddubbo.application.serialize-check-status=WARN
我尝试过在网上看其他项目去解决这个问题,但我没有找到可以解决的,问过chatGpt,它们给出来的答案都不生效,所以来请教一下这个我要怎么去设置?是在消费层出现的错误 下面是我消费层关于dubbo的设置,再下面就是消费层的报错信息。
dubbo: application: name: cloud-demo-nacos-order-consumer qos-enable: false registry: address: nacos://localhost:8848
2023-04-04 16:59:36.027 ERROR 10204 --- [lientWorker-4-1] o.a.d.c.u.DefaultSerializeClassChecker : [DUBBO] [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode is
WARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it., dubbo version: 3.1.8, current host: 192.168.110.1, error code: 4-21. This may be caused by , go to https://dubbo.apache.org/faq/4/21 to find instructions.2023-04-04 16:59:36.041 ERROR 10204 --- [p-nio-88-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.dubbo.rpc.RpcException: Failed to invoke the method add in the service com.lc.service.ITestInfoService. Tried 3 times of the providers [192.168.110.1:20880] (1/1) from the registry localhost:8848 on the consumer 192.168.110.1 using the dubbo version 3.1.8. Last error is: Failed to invoke remote method: add, provider: DefaultServiceInstance{serviceName='cloud-provider-service', host='192.168.110.1', port=20880, enabled=true, healthy=true, metadata={dubbo.metadata-service.url-params={"connections":"1","version":"1.0.0","dubbo":"2.0.2","release":"3.1.8","side":"provider","port":"20880","protocol":"dubbo"}, dubbo.endpoints=[{"port":20880,"protocol":"dubbo"}], dubbo.metadata.revision=4d666a0dcbf546a2f9a43c423b9d40fe, dubbo.metadata.storage-type=local, timestamp=1680596517041}}, service{name='com.lc.service.ITestInfoService',group='null',version='null',protocol='dubbo',port='20880',params={check.serializable=true, side=provider, release=3.1.8, methods=add,addBatch,count,count,delete,deleteBack,deleteBatch,deleteBatchBack,get,getBaseMapper,getById,getEntityClass,getMap,getObj,getOne,getOne,ktQuery,ktUpdate,lambdaQuery,lambdaQuery,lambdaUpdate,list,list,listByIds,listByLike,listByMap,listMaps,listMaps,listObjs,listObjs,listObjs,listObjs,page,page,pageByCondition,pageByLike,pageMaps,pageMaps,query,remove,removeBatchByIds,removeBatchByIds,removeBatchByIds,removeBatchByIds,removeById,removeById,removeById,removeByIds,removeByIds,removeByMap,save,saveBatch,saveBatch,saveOrUpdate,saveOrUpdate,saveOrUpdateBatch,saveOrUpdateBatch,update,update,update,update,updateBack,updateBatchById,updateBatchById,updateById, deprecated=false, dubbo=2.0.2, interface=com.lc.service.ITestInfoService, service-name-mapping=true, generic=false, application=cloud-provider-service, background=false, dynamic=true, anyhost=true},}, cause: org.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode is
WARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it. io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode isWARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it. at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:304) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115) at org.apache.dubbo.remoting.transport.netty4.NettyClientHandler.write(NettyClientHandler.java:88) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879) at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940) at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1247) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalArgumentException: [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode isWARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it. at org.apache.dubbo.common.utils.DefaultSerializeClassChecker.loadClass0(DefaultSerializeClassChecker.java:165) at org.apache.dubbo.common.utils.DefaultSerializeClassChecker.loadClass(DefaultSerializeClassChecker.java:104) at org.apache.dubbo.common.serialize.hessian2.Hessian2SerializerFactory.getDefaultSerializer(Hessian2SerializerFactory.java:49) at com.alibaba.com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java:393) at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:411) at org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectOutput.writeObject(Hessian2ObjectOutput.java:99) at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.encodeRequestData(DubboCodec.java:208) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:261) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:75) at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:47) at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:69) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ... 22 more ] with root causeorg.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode is
WARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it. io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode isWARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it. at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:304) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856) at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115) at org.apache.dubbo.remoting.transport.netty4.NettyClientHandler.write(NettyClientHandler.java:88) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879) at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940) at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1247) at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalArgumentException: [Serialization Security] Serialized class org.apache.catalina.connector.RequestFacade is in disallow list. Current mode isWARN
, will disallow to deserialize it by default. Please add it into security/serialize.allowlist or follow FAQ to configure it. at org.apache.dubbo.common.utils.DefaultSerializeClassChecker.loadClass0(DefaultSerializeClassChecker.java:165) at org.apache.dubbo.common.utils.DefaultSerializeClassChecker.loadClass(DefaultSerializeClassChecker.java:104) at org.apache.dubbo.common.serialize.hessian2.Hessian2SerializerFactory.getDefaultSerializer(Hessian2SerializerFactory.java:49) at com.alibaba.com.caucho.hessian.io.SerializerFactory.getSerializer(SerializerFactory.java:393) at com.alibaba.com.caucho.hessian.io.Hessian2Output.writeObject(Hessian2Output.java:411) at org.apache.dubbo.common.serialize.hessian2.Hessian2ObjectOutput.writeObject(Hessian2ObjectOutput.java:99) at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.encodeRequestData(DubboCodec.java:208) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:261) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:75) at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:47) at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:69) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ... 22 more