dubbo异常记录

来源:互联网 发布:osx数据恢复 编辑:程序博客网 时间:2024/05/22 03:51

一、服务端一直重复出现找不到MonitorService服务提供者的异常

  1. No provider available for the service com.alibaba.dubbo.monitor.MonitorService  

解决:

这是因为没有启动监控中心,却配了监控地址,把监控中心启动,或者把xml配置中的<dubbo:monitor protocol="registry">或properties配置中的dubbo.monitor.protocol=registry去掉。




二、发布服务时服务无法成功注册的问题

   异常信息如下:

Caused by: com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method subscribe in the service com.alibaba.dubbo.registry.RegistryService. Tried 3 times of the providers [192.168.20.115:2181] (1/1) from the registry 192.168.20.115:2181 on the consumer 192.168.20.115 using the dubbo version 2.5.3. Last error is: Invoke remote method timeout. method: subscribe

Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout. start time: 2016-10-08 18:27:43.346, end time: 2016-10-08 18:27:53.355, client elapsed: 8 ms

信息: Illegal access: this web application instance has been stopped already.  Could not load org.apache.log4j.spi.ThrowableInformation.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.java.lang.IllegalStateExceptionat org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1743)at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701)at org.apache.log4j.spi.LoggingEvent.<init>(LoggingEvent.java:159)

配置的注册中心地址一定是要带协议,比如应该配置为:zookeeper://10.0.50.150:2181,而不是10.0.50.150:2181。
原因分析:
dubbo.properties配置为10.0.50.150:2181会带来问题,因为没有配置注册中心协议,所以默认就是dubbo,这样这个地址其实变为了:dubbo://10.0.50.150:2181,dubbo会认为注册中心地址是一个dubbo服务,但其实10.0.50.150:2181运行的是一个zookeeper服务,根本不是dubbo服务,内部报错,然后注册时应用等待超时。
错误写法:<dubbo:registry  address="192.168.20.115:2181"/>
正确写法:
     <dubbo:registry  address="zookeeper://192.168.20.115:2181"/>
或  <dubbo:registry  address="192.168.20.115:2181" protocol="zookeeper"/>





0 0