首页 > 代码库 > com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method

查看了网友们的错误原因,

  1. 需要进行实例化的类没有进行实例化,具体没有实例化的类会在错误信息中显示,在错误信息中搜索“Serializable”即可找到将其实现序列化可消除错误。
  2. 是在使用Dubbo提供服务是在主机上启动了虚拟机的网络,在Windows中具体可以,在运行中输入“CMD”在CMD窗口中输入"ifconfig"命令查看,如果有其他除本地的网络链接,通过命令或者将其手动禁止,再启动Dubbo服务可以解决问题。
  3. 防火墙对应端口没有开启

我这里都不是因为这些导致的。

2017-02-10 21:57:22,653 ERROR [PmsLoginAction.java:136] : login exception:
com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method findUserByUserNo in the service wusc.edu.facade.user.service.PmsUserFacade. No provider available for the service wusc.edu.facade.user.service.PmsUserFacade from registry 192.168.133.10:2181 on the consumer 192.168.0.101 using the dubbo version 2.5.3. Please check if the providers have been started and registered.
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.checkInvokers(AbstractClusterInvoker.java:246)
	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:55)
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:227)
	at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72)
	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52)
	at com.alibaba.dubbo.common.bytecode.proxy0.findUserByUserNo(proxy0.java)
	at wusc.edu.web.boss.action.PmsLoginAction.userLogin(PmsLoginAction.java:60)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
	at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
	at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
	at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Unknown Source)

我出错原因有点与众不同,呵呵,竟是因为看到警告就加了句context.close();

 1     public static void main(String[] args) {
 2         try {
 3             ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-context.xml");
 4             context.start();
 5             // context.close();  // 出错根源
 6         } catch (Exception e) {
 7             log.error("== DubboProvider context start error:",e);
 8         }
 9         synchronized (DubboProvider.class) {
10             while (true) {
11                 try {
12                     DubboProvider.class.wait();
13                 } catch (InterruptedException e) {
14                     log.error("== synchronized error:",e);
15                 }
16             }
17         }
18     }

:)

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method