You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "jadedrip (via GitHub)" <gi...@apache.org> on 2023/04/10 06:26:06 UTC

[GitHub] [dubbo] jadedrip opened a new issue, #12045: 怎么配置才能让 hessian2 序列号忽略 Serializable?

jadedrip opened a new issue, #12045:
URL: https://github.com/apache/dubbo/issues/12045

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   dubbo 3.1.9 版本
   
   <!-- For all design discussions please continue. -->
   我用的 spring-boot, 在配置文件里加入了 
   ```
   dubbo:
     application:
       # 关闭序列化严格检查
       check-serializable: false
     protocol:
       serialization: hessian2
     hessian:
       allow-non-serializable: true
   ```
   但仍然报 `must implement java.io.Serializable`.
   我做了点研究,发现 allow-non-serializable 似乎无法生效,源码里用的 
   
   `serializerFactory.setAllowNonSerializable(Boolean.parseBoolean(System.getProperty("dubbo.hessian.allowNonSerializable", "false")));`
   
   这样似乎只有 jvm 的 -D 配置才行?我不得已改了 jvm,但发现仍然报错,这回 isAllowNonSerializable 返回 true 了,但还是报错,追踪源码又发现了这个:
   
   ```
       @Override
       protected Deserializer getDefaultDeserializer(Class cl) {
           try {
               // pre-check if class is allow
               defaultSerializeClassChecker.loadClass(getClassLoader(), cl.getName());
           } catch (ClassNotFoundException e) {
               // ignore
           }
   
           if (!Serializable.class.isAssignableFrom(cl)
               && (!isAllowNonSerializable() || !defaultSerializeClassChecker.isCheckSerializable())) {
               throw new IllegalStateException("Serialized class " + cl.getName() + " must implement java.io.Serializable");
           }
   
           return new JavaDeserializer(cl);
       }
   ```
   
   这个 !isAllowNonSerializable() || !defaultSerializeClassChecker.isCheckSerializable() 的判断让我搞不懂了,两个都必须是 true 才行?也就是 check-serializable 需要打开,而我打开了 check-serializable
   
   轮到 loadClass 里面报错了,这到底应该怎么整啊??
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on issue #12045: 怎么配置才能让 hessian2 序列类型忽略 Serializable?

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12045:
URL: https://github.com/apache/dubbo/issues/12045#issuecomment-1501615453

   Fixed in https://github.com/apache/dubbo/pull/12054


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on issue #12045: 怎么配置才能让 hessian2 序列类型忽略 Serializable?

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12045:
URL: https://github.com/apache/dubbo/issues/12045#issuecomment-1709935449

   > 现在是什么情况 我也报这个错了
   
   请问使用的是什么版本呢


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] lexang commented on issue #12045: 怎么配置才能让 hessian2 序列类型忽略 Serializable?

Posted by "lexang (via GitHub)" <gi...@apache.org>.
lexang commented on issue #12045:
URL: https://github.com/apache/dubbo/issues/12045#issuecomment-1706316104

   现在是什么情况  我也报这个错了


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org