You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/11/08 12:50:19 UTC

[GitHub] [dubbo] lucky-xin opened a new issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

lucky-xin opened a new issue #9237:
URL: https://github.com/apache/dubbo/issues/9237


   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0.4
   * Operating System version: MAC OS Monterey
   * Java version: jdk8
   
   ### Steps to reproduce this issue
   ### 服务消费者传递org.bson.types.ObjectId到服务提供者ObjectId和消费着的ObjectId不一致
   1. 服务消费者设置一个ObjectId调用服务提供者
   2. 服务提供者拿到ObjectId然后打印
   3. 两个ObjectId不一致
    服务提供者实现代码
   ![image](https://user-images.githubusercontent.com/13815910/140744335-7f3420d8-311a-4cd9-bcfd-e46aeb342fe5.png)
   服务消费者实现代码
   ![image](https://user-images.githubusercontent.com/13815910/140744400-c189f407-85e1-496c-a916-e628ac7dc8cd.png)
   测试单元代码
   ![image](https://user-images.githubusercontent.com/13815910/140744516-4313bae6-28d4-4ded-bd4c-20cc9215e95c.png)
   [复现项目代码链接](https://github.com/lucky-xin/dubbo-samples)
   
   Pls. provide [GitHub address] to reproduce this issue.
   
   ### Expected Behavior
   
   期望消费者与提供者之间传递ObjectId时,序列化以及反序列化之后,ObjectId值不变
   
   ### Actual Behavior
   
   <!-- What actually happens? -->
   
   If there is an exception, please attach the exception trace:
   
   ```
   Just put your stack trace here!
   ```
   


-- 
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] lucky-xin commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
lucky-xin commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-964849786


   yes.


-- 
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] lucky-xin commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
lucky-xin commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-964858378


   > Is hessian2 used as the serialization method? @lucky-xin
   
   yes


-- 
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] zrlw commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
zrlw commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-977785446


   @stone-98 
   是不是在dubbo-hessian-lite的pom文件加入bson依赖:
   ```
   <dependency>
       <groupId>org.mongodb</groupId>
       <artifactId>bson</artifactId>
       <version>4.4.0</version>
   </dependency>
   ```
   然后实现
   1. ObjectIdHandler
   构造方法入参为ObjectId对象,调用ObjectId.toByteArray()方法获取byte数组并保存;
   2. ObjectIdSerializer:
   new ObjectId(ObjectIdHandler的byte数组变量)创建ObjectId对象;
   3. SerializerFactory#getSerializer增加ObjectId分支,配置ObjectIdHandler
   4. 增加用于验证的单元测试
   如果上述理解没有问题,我可以代你加个PR。
   
   我有个疑问,有没有更加通用一点的办法么?每个默认序列化方法搞不定的数据类型难道都要在pom里面去加一个依赖才可以么?


-- 
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] stone-98 commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
stone-98 commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-966833965


   @i will solve it@


-- 
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] stone-98 commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
stone-98 commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-966384639


   mark


-- 
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] CrazyHZM commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
CrazyHZM commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-964805939


   Is hessian2 used as the serialization method?
   @lucky-xin 


-- 
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] lucky-xin removed a comment on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
lucky-xin removed a comment on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-964849786


   yes.


-- 
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] CrazyHZM commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
CrazyHZM commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-968186446


   @stone-98 
   You can fix this problem in https://github.com/apache/dubbo-hessian-lite


-- 
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] stone-98 commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
stone-98 commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-972981503


   I can't read the Hessian source code. -.-!!!


-- 
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] stone-98 commented on issue #9237: org.bson.types.ObjectId序列化以及反序列化问题

Posted by GitBox <gi...@apache.org>.
stone-98 commented on issue #9237:
URL: https://github.com/apache/dubbo/issues/9237#issuecomment-968073701


   @CrazyHZM 我在 @lucky-xin 给的案例上面测试,发现是hessian的问题。
   ![image](https://user-images.githubusercontent.com/35629966/141646650-c1a250cf-efac-46de-a787-fe4351815cab.png)
   但是我有一点不太明白,Dubbo之前是嵌入式的引入hessian,但是现在是以依赖的方式引入hessian,我该怎么做?


-- 
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