代码常见异常

1.在注册中心找不到对应的服务

java.lang.IllegalStateException: Failed to check the status of the service com.offcn.sellergoods.service.BrandService. 
No provider available for the service com.offcn.sellergoods.service.BrandService from the url 
zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=youle xuan-manager-
web&dubbo=2.8.4&interface=com.offcn.sellergoods.service.BrandService&metho 
ds=update,get,delete,selectOptionList,add,getListByPage&pid=3980&revision=0.0.1-SNAPSHOT& 
side=consumer&timestamp=1501146823396 to the consumer 172.16.17.14 use dubbo version 2.8.4

这种错误是服务层代码没有成功注册到注册中心导致,请检查一下你的服务层代码是否添加 了@service 注解,并且该注解的包一定是 com.alibaba.dubbo.config.annotation 包,不是org.springframework.stereotype.Service,这个地方极容易出错。另外还有一个原因就是你的 服务层工程由于某些原因没有正常启动,也无法注册到注册中心里。

2.无法连接到注册中心

[org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168.188.137/192.168.188.137:2181. Will not attempt to authenticate using SASL (unknown error)
[org.apache.zookeeper.ClientCnxn] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.ja va:361)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)  
[org.apache.zookeeper.ClientCnxnSocketNIO] - Ignoring exception during shutdown input

请检查 IP 与端口是否填写正确,检查注册中心是否正常启动

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值