博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
dubbo异常: Failed to invoke the method getFormulaZtree in the service 异常解决方案
阅读量:6508 次
发布时间:2019-06-24

本文共 10523 字,大约阅读时间需要 35 分钟。

hot3.png

当调用dubbo远程服务方法时报错:

2017-04-05 18:07:41 [http-apr-8080-exec-4] [ERROR] com.ipharmacare.yb.formula.controller.FormulaController61 -获取计算公式信息目录树出错!com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method getFormulaZtree in the service com.ipharmacare.yb.services.formula.IFormulaApi. Tried 3 times of the providers [10.1.2.37:20885] (1/1) from the registry 10.1.2.37:2181 on the consumer 172.31.187.8 using the dubbo version 2.8.4.1. Last error is: Failed to invoke remote method: getFormulaZtree, provider: dubbo://10.1.2.37:20885/com.ipharmacare.yb.services.formula.IFormulaApi?anyhost=true&application=yb-web&check=false&default=true&default.check=false&default.payload=83886080&default.timeout=300000&dubbo=2.8.4.1&generic=false&interface=com.ipharmacare.yb.services.formula.IFormulaApi&logger=slf4j&methods=updateFormula,getFormulaZtree,getFormulaById&payload=83886080&pid=9412&side=consumer&timestamp=1491386763876, cause: Fail to decode request due to: RpcInvocation [methodName=getFormulaZtree, parameterTypes=null, arguments=null, attachments={dubbo=2.8.4.1, input=437, path=com.ipharmacare.yb.services.formula.IFormulaApi, version=0.0.0}]	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:101) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:227) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.common.bytecode.proxy5.getFormulaZtree(proxy5.java) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.ipharmacare.yb.formula.service.FormulaService.getFormulaZtree(FormulaService.java:46) ~[classes/:na]	at com.ipharmacare.yb.formula.controller.FormulaController.getFormulaZtree(FormulaController.java:51) ~[classes/:na]	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:685) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) [servlet-api.jar:na]	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) [servlet-api.jar:na]	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.72]	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.72]	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.72]	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.72]	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.72]	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.9.RELEASE.jar:3.2.9.RELEASE]	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.72]	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.72]	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) [urlrewritefilter-4.0.3.jar:4.0.3]	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) [urlrewritefilter-4.0.3.jar:4.0.3]	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) [urlrewritefilter-4.0.3.jar:4.0.3]	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394) [urlrewritefilter-4.0.3.jar:4.0.3]	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.72]	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.72]	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) [catalina.jar:7.0.72]	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [catalina.jar:7.0.72]	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) [catalina.jar:7.0.72]	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) [catalina.jar:7.0.72]	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [catalina.jar:7.0.72]	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) [catalina.jar:7.0.72]	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [catalina.jar:7.0.72]	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442) [catalina.jar:7.0.72]	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083) [tomcat-coyote.jar:7.0.72]	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640) [tomcat-coyote.jar:7.0.72]	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517) [tomcat-coyote.jar:7.0.72]	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506) [tomcat-coyote.jar:7.0.72]	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112]	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112]	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-coyote.jar:7.0.72]	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]Caused by: com.alibaba.dubbo.remoting.RemotingException: Fail to decode request due to: RpcInvocation [methodName=getFormulaZtree, parameterTypes=null, arguments=null, attachments={dubbo=2.8.4.1, input=437, path=com.ipharmacare.yb.services.formula.IFormulaApi, version=0.0.0}]	at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:190) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:110) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:84) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:96) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:148) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:48) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:74) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) ~[dubbo-2.8.4.1.jar:2.8.4.1]	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77) ~[dubbo-2.8.4.1.jar:2.8.4.1]	... 54 common frames omitted

在dubbo配置文件中

dubbo.container=log4j,springdubbo.application.name=webdubbo.application.owner=ipharmacare#dubbo.registry.address=multicast://224.5.6.7:1234dubbo.registry.address=zookeeper\://10.1.2.37\:2181  // 由于修改了代码  并没有提交上去,所以该地址指向的是主机,而不是本地.当web调用我在注册中心写的方法时,肯定出错.dubbo.protocol.name=dubbodubbo.protocol.port=38889dubbo.consumer.timeout=300000#dubbo.registry.address=redis://127.0.0.1:6379#dubbo.registry.address=dubbo://127.0.0.1:9090#dubbo.consumer.timeout=2dubbo.log4j.file=logs/yb-web.logdubbo.log4j.level=WARNnoPermUrl=

解决方案: 将

dubbo.registry.address=zookeeper\://10.1.2.37\:2181

改为

dubbo.registry.address=zookeeper\://127.0.0.1\:2181

遇到该异常可能还有其他情况: 实体类没有实现java.io.Serializable,因为是远程服务,所有必须实现序列化接口

暂时就是这么些,欢迎大家补充!

转载于:https://my.oschina.net/u/3152087/blog/873606

你可能感兴趣的文章
当 IDENTITY_INSERT 设置为 OFF 时,不能为表中的标识列插入显式值
查看>>
阿里云MaxCompute,用计算力让数据发声
查看>>
tomcat 6 URIEncoding
查看>>
移动网页UI交互设计---体验
查看>>
产品经理工具之–UML建模类
查看>>
linux下IPTABLES配置详解
查看>>
对话Ruby创始人松本行弘、阿里高级技术专家朴灵!
查看>>
771. Jewels and Stones - LeetCode
查看>>
Sed简介
查看>>
WINDOWS DNS备份、还原
查看>>
Hive连接?
查看>>
好程序员大数据笔记之:Hadoop集群搭建
查看>>
如何利用分层测试概念设计针对性测试用例
查看>>
路由器的无线桥接(TP-Link)
查看>>
解决CodeIgniter伪静态失效
查看>>
PostgreSQL数据库压力测试工具pgbench简单应用
查看>>
信息系统审计准则(征求意见稿)
查看>>
世界由物质、能量、信息
查看>>
获取IOS设备型号的代码
查看>>
iOS培训教程——TableView(内置刷新)
查看>>