You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "yzlxlf (via GitHub)" <gi...@apache.org> on 2023/03/24 07:24:08 UTC

[GitHub] [dubbo] yzlxlf opened a new issue, #11912: dubbo ClassCastException

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

   jdk: 1.8.0_202-b08
   vm: k8s
   dubbo version: 2.7.15
   
   consumer端发起dubbo
   示例代码如下:
   
   @DubboReference
   private TestFacade testFacade;
   
   public void test(XxxTestReq req) {
         Response<XxxTestResp> resp = testFacade.test(req);
   }
   
   其中Response的定义:
   public class Response<T>  implements Serializable {
            private static final long serialVersionUID = 1L;
            public T data;
   }
   
   在获取resp.getData()的时候,发现,其运行时的对象不是XxxTestResp,二十一个HashMap,同时,我们检查了
   XxxTestResp对象,其实现了Serializable 并且显示指定了serialVersionUID,dubbo的consumer和provider对应的serialVersionUID也都是一样的
   
   出现问题的代码是在开发环境,但是相同的代码在测试环境运行,就不会出现ClassCastException,并且运行正常
   ,dubbo的请求和环境有关吗?


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


Re: [I] dubbo ClassCastException [dubbo]

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

   please upgrade to the latest version. If you still have problems, please reopen the issue


-- 
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] steveraman117 commented on issue #11912: dubbo ClassCastException

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

   > > 遇到类似问题,也是2.7.15版本,且同一个docker镜像,重启后自己又好了,正式环境偶发,测试环境从未出现过,本地无法复现 `java.lang.ClassCastException: java.util.HashMap cannot be cast to XXX`
   > 
   > 找一下 std 输出流,hessian 应该有报错输出
   
   在std中找到日志了,最后排查原因是:在某些java8版本下,在CompletableFuture中getClassLoader()会得到null。
   由于hessian只在首次初始化时保存loader,结果是个null。
   所以出现概率性发生异常,重启后会好的情况:因为和首次进行dubbo调用的线程有关。


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


Re: [I] dubbo ClassCastException [dubbo]

Posted by "wxbty (via GitHub)" <gi...@apache.org>.
wxbty closed issue #11912: dubbo ClassCastException
URL: https://github.com/apache/dubbo/issues/11912


-- 
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 #11912: dubbo ClassCastException

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

   可能是开发环境有其他的机器发布了有问题的服务,然后调用到了


-- 
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 #11912: dubbo ClassCastException

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

   > 遇到类似问题,也是2.7.15版本,且同一个docker镜像,重启后自己又好了,正式环境偶发,测试环境从未出现过,本地无法复现 `java.lang.ClassCastException: java.util.HashMap cannot be cast to XXX`
   
   找一下 std 输出流,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


[GitHub] [dubbo] steveraman117 commented on issue #11912: dubbo ClassCastException

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

   遇到类似问题,也是2.7.15版本,且同一个docker镜像,重启后自己又好了,正式环境偶发,测试环境从未出现过,本地无法复现
   `java.lang.ClassCastException: java.util.HashMap cannot be cast to XXX`


-- 
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 #11912: dubbo ClassCastException

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

   > > > 遇到类似问题,也是2.7.15版本,且同一个docker镜像,重启后自己又好了,正式环境偶发,测试环境从未出现过,本地无法复现 `java.lang.ClassCastException: java.util.HashMap cannot be cast to XXX`
   > > 
   > > 
   > > 找一下 std 输出流,hessian 应该有报错输出
   > 
   > 在std中找到日志了,最后排查原因是:在某些java8版本下,在CompletableFuture中getClassLoader()会得到null。 由于hessian的ClassFactory只在首次初始化时保存loader,结果是个null,后续就一种用null加载类。 所以出现概率性发生异常,重启后会好的情况:因为和首次进行dubbo调用的线程有关。
   
   可以升级下 3.x 版本,高版本对于多 classloader 的支持会完善很多


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