日期:2023-04-28 06:06:02 来源:脚本之家
使用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®istry=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®istry=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®istry=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®istry=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®istry=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®istry=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引起的
org.springframework.boot spring-boot-devtools true
估计是和dubbo有点冲突
作为一个dubbo使用新手,有必要总结一些常见的dubbo问题,提升解决问题的套路。
问题:
No provider available from registry xxx from service xxx on consumer xxx may be providers disabled or not registrered。
如下图所示:
原因:
根据源码的截图所示(下图),就两个原因:
1)No service provider
2)Service providers are disabled
解决办法:
1).provider部署分支不正确,部署正确的分支。
2).consumer部署分支的zookeeper地址不正确。
问题:
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服务。
问题:
Caused by: com.alibaba.dubbo.common.bytecode.NoSuchMethodException: Not found method “getSocialResourceByRegionId” in class com.missfresh.product.center.service.impl.SocialResourceServiceImpl.
原因:
dubbo服务部署的分支里没有相关接口的实现。
解决方法:
部署对应的分支。或者是直接部署master。
问题:
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.
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。
标签:
下一篇:最后一页