springboot-dubbo cannot be cast to问题及解决

 更新时间:2023年04月27日 16:54:22   作者:勤奋的蜗牛t  
这篇文章主要介绍了springboot-dubbo cannot be cast to问题及解决方案,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教

springboot-dubbo cannot be cast to

使用spring boot 集成dubbo的时候遇到问题:

2018-05-22 14:41:35.108 ERROR 2224 --- [:20880-thread-2] c.a.dubbo.rpc.filter.ExceptionFilter     :  [DUBBO] Got unchecked and undeclared exception which called by 10.0.75.1. service: com.neo.facade.UseServiceFacade, method: getAll, exception: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method getAll to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&dubbo=2.5.3&export=dubbo%3A%2F%2F10.0.75.1%3A20880%2Fcom.neo.facade.UseServiceFacade%3Fanyhost%3Dtrue%26application%3Dprovider%26dubbo%3D2.5.3%26interface%3Dcom.neo.facade.UseServiceFacade%26methods%3DgetAll%2CgetOne%2Cupdate%2Cinsert%2Cdelete%26pid%3D2224%26revision%3D1.0.0%26side%3Dprovider%26timestamp%3D1526971274301%26version%3D1.0.0&pid=2224&registry=zookeeper×tamp=1526971274290, cause: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService, dubbo version: 2.5.3, current host: 127.0.0.1
 
com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method getAll to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&dubbo=2.5.3&export=dubbo%3A%2F%2F10.0.75.1%3A20880%2Fcom.neo.facade.UseServiceFacade%3Fanyhost%3Dtrue%26application%3Dprovider%26dubbo%3D2.5.3%26interface%3Dcom.neo.facade.UseServiceFacade%26methods%3DgetAll%2CgetOne%2Cupdate%2Cinsert%2Cdelete%26pid%3D2224%26revision%3D1.0.0%26side%3Dprovider%26timestamp%3D1526971274301%26version%3D1.0.0&pid=2224&registry=zookeeper×tamp=1526971274290, cause: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) [dubbo-2.5.3.jar:2.5.3]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) ~[na:2.5.3]
    at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) ~[dubbo-2.5.3.jar:2.5.3]
    ... 25 common frames omitted
Caused by: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    ... 28 common frames omitted
 
2018-05-22 14:41:35.126 ERROR 2224 --- [:20880-thread-3] c.a.dubbo.rpc.filter.ExceptionFilter     :  [DUBBO] Got unchecked and undeclared exception which called by 10.0.75.1. service: com.neo.facade.UseServiceFacade, method: getAll, exception: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method getAll to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&dubbo=2.5.3&export=dubbo%3A%2F%2F10.0.75.1%3A20880%2Fcom.neo.facade.UseServiceFacade%3Fanyhost%3Dtrue%26application%3Dprovider%26dubbo%3D2.5.3%26interface%3Dcom.neo.facade.UseServiceFacade%26methods%3DgetAll%2CgetOne%2Cupdate%2Cinsert%2Cdelete%26pid%3D2224%26revision%3D1.0.0%26side%3Dprovider%26timestamp%3D1526971274301%26version%3D1.0.0&pid=2224&registry=zookeeper×tamp=1526971274290, cause: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService, dubbo version: 2.5.3, current host: 127.0.0.1
 
com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method getAll to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&dubbo=2.5.3&export=dubbo%3A%2F%2F10.0.75.1%3A20880%2Fcom.neo.facade.UseServiceFacade%3Fanyhost%3Dtrue%26application%3Dprovider%26dubbo%3D2.5.3%26interface%3Dcom.neo.facade.UseServiceFacade%26methods%3DgetAll%2CgetOne%2Cupdate%2Cinsert%2Cdelete%26pid%3D2224%26revision%3D1.0.0%26side%3Dprovider%26timestamp%3D1526971274301%26version%3D1.0.0&pid=2224&registry=zookeeper×tamp=1526971274290, cause: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) [dubbo-2.5.3.jar:2.5.3]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) ~[na:2.5.3]
    at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) ~[dubbo-2.5.3.jar:2.5.3]
    ... 25 common frames omitted
Caused by: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    ... 28 common frames omitted
 
2018-05-22 14:41:35.133 ERROR 2224 --- [:20880-thread-4] c.a.dubbo.rpc.filter.ExceptionFilter     :  [DUBBO] Got unchecked and undeclared exception which called by 10.0.75.1. service: com.neo.facade.UseServiceFacade, method: getAll, exception: com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method getAll to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&dubbo=2.5.3&export=dubbo%3A%2F%2F10.0.75.1%3A20880%2Fcom.neo.facade.UseServiceFacade%3Fanyhost%3Dtrue%26application%3Dprovider%26dubbo%3D2.5.3%26interface%3Dcom.neo.facade.UseServiceFacade%26methods%3DgetAll%2CgetOne%2Cupdate%2Cinsert%2Cdelete%26pid%3D2224%26revision%3D1.0.0%26side%3Dprovider%26timestamp%3D1526971274301%26version%3D1.0.0&pid=2224&registry=zookeeper×tamp=1526971274290, cause: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService, dubbo version: 2.5.3, current host: 127.0.0.1
 
com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method getAll to registry://127.0.0.1:2181/com.alibaba.dubbo.registry.RegistryService?application=provider&dubbo=2.5.3&export=dubbo%3A%2F%2F10.0.75.1%3A20880%2Fcom.neo.facade.UseServiceFacade%3Fanyhost%3Dtrue%26application%3Dprovider%26dubbo%3D2.5.3%26interface%3Dcom.neo.facade.UseServiceFacade%26methods%3DgetAll%2CgetOne%2Cupdate%2Cinsert%2Cdelete%26pid%3D2224%26revision%3D1.0.0%26side%3Dprovider%26timestamp%3D1526971274301%26version%3D1.0.0&pid=2224&registry=zookeeper×tamp=1526971274290, cause: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:60) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:112) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:108) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) [dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) [dubbo-2.5.3.jar:2.5.3]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    at com.alibaba.dubbo.common.bytecode.Wrapper1.invokeMethod(Wrapper1.java) ~[na:2.5.3]
    at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) ~[dubbo-2.5.3.jar:2.5.3]
    at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) ~[dubbo-2.5.3.jar:2.5.3]
    ... 25 common frames omitted
Caused by: java.lang.ClassCastException: com.neo.service.UserService cannot be cast to com.neo.service.UserService
    ... 28 common frames omitted

是由spring-boot-devtools引起的

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

估计是和dubbo有点冲突

dubbo报错总结

作为一个dubbo使用新手,有必要总结一些常见的dubbo问题,提升解决问题的套路。

1.dubbo consumer 调用provider报错(1)- No provider available

问题

No provider available from registry xxx from service xxx on consumer xxx may be providers disabled or not registrered。

如下图所示:

dubbo报错

原因:  

根据源码的截图所示(下图),就两个原因: 

1)No service provider  

2)Service providers are disabled

源码分析

解决办法:  

1).provider部署分支不正确,部署正确的分支。  

2).consumer部署分支的zookeeper地址不正确。

2.dubbo consumer调用provider报错(2)

问题

com.alibaba.dubbo.rpc.RpcException: Rpc cluster invoker for interface xxx on consumer 10.2.4.63 use dubbo version 2.6.0.2 is now destroyed! Can not invoke any more.

问题截图

原因

源码分析

调用链路:invoke()–>checkWhetherDestroyed()

consumer端调用的时候,发现出现实例已经destory,就抛出此异常

怀疑是由于内存不足,dubbo进程触发了spring的destroy()方法,同时就执行到了AbstractClusterInvoker.destroy(),但是此时进程并没有挂掉,所以就出现了可以调用,但是调用失败的情况。

解决方法:  

1)查看provider服务器是否内存不够,kill掉不相干的进程。  

2)重启provider服务。

3.dubbo consumer 调用provider报错(3)- NoSuchMethodException

问题

Caused by: com.alibaba.dubbo.common.bytecode.NoSuchMethodException: Not found method “getSocialResourceByRegionId” in class com.missfresh.product.center.service.impl.SocialResourceServiceImpl.

问题截图

原因:  

dubbo服务部署的分支里没有相关接口的实现。

解决方法:  

部署对应的分支。或者是直接部署master。

4.dubbo consumer 调用provider报错(4)- Thread pool is EXHAUSTED!

问题

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method queryProductSalsPromotionTagList in the service com.missfresh.product.center.service.IProductCategorysService. Tried 1 times of the providers

问题截图

原因:

原因分析

如上图所示,provider服务支持的最大线程数为300。

解决方法:  

检查程序中并发采用的线程池初始化值,是否合理。最大线程个数不能大于300.

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • Java在ElasticSearch中使用LocalDatetime类型

    Java在ElasticSearch中使用LocalDatetime类型

    最近在开发一个搜索功能的需求的时候,遇到了LocalDatetime类型不能保存到ElasticSearch中的问题,这篇文章主要介绍了Java在ElasticSearch中使用LocalDatetime类型
    2023-10-10
  • JAVA使用ElasticSearch查询in和not in的实现方式

    JAVA使用ElasticSearch查询in和not in的实现方式

    今天小编就为大家分享一篇关于JAVA使用Elasticsearch查询in和not in的实现方式,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2018-12-12
  • Mybatis传递多个参数的解决办法(三种)

    Mybatis传递多个参数的解决办法(三种)

    这篇文章主要介绍了Mybatis传递多个参数的解决办法(三种),个人觉得第三种解决办法比较好用,有需要的朋友一起学习吧
    2016-05-05
  • Java中的ArrayList容量及扩容方式

    Java中的ArrayList容量及扩容方式

    这篇文章主要介绍了Java中的ArrayList容量及扩容方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2021-09-09
  • Java不可不知的泛型使用示例代码

    Java不可不知的泛型使用示例代码

    这篇文章主要介绍了Java不可不知的泛型使用,本文通过实例代码给大家介绍了java的泛型的基本使用,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2020-08-08
  • Java tomcat手动配置servlet详解

    Java tomcat手动配置servlet详解

    这篇文章主要为大家介绍了tomcat手动配置servlet,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能够给你带来帮助
    2021-11-11
  • Spring 项目常用pom文件的依赖

    Spring 项目常用pom文件的依赖

    这篇文章主要介绍了Spring 项目常用pom文件的依赖,文中给大家提到了Spring boot starter pom的依赖关系说明,需要的朋友参考下吧
    2018-03-03
  • SpringBoot配置动态数据源的实战详解

    SpringBoot配置动态数据源的实战详解

    Spring对数据源的管理类似于策略模式,不懂策略模式也没关系,其实就是有一个全局的键值对,类型是Map<String, DataSource>,当JDBC操作数据库之时,会根据不同的key值选择不同的数据源,本文介绍了SpringBoot配置动态数据源的方法,需要的朋友可以参考下
    2024-08-08
  • java对象序列化操作实例分析

    java对象序列化操作实例分析

    这篇文章主要介绍了java对象序列化操作,结合实例形式分析了java对象序列化操作相关实现步骤与操作注意事项,需要的朋友可以参考下
    2019-11-11
  • Java中包装类介绍与其注意事项

    Java中包装类介绍与其注意事项

    Java语言是一个面向对象的语言,但是Java中的基本数据类型却是不面向对象的,这在实际使用时存在很多的不便,所以在设计类时为每个基本数据类型设计了一个对应的类进行代表,这样八个和基本数据类型对应的类统称为包装类,有些地方也翻译为外覆类或数据类型类。
    2017-02-02

最新评论