dubbo的consumer只能调用同一台服务器的provider

空白-键 2015-10-21 12:43:35
我在一台阿里云上部署了dubbo的provider和consumer项目,运行没问题。
在自己本地开发机子上部署consumer项目,调用不了阿里云上的provider。
然后我又试了下,停掉阿里云的provider,改为部署在本地,那本地的consumer项目运行正常了,但是阿里云上的consumer项目就报错了。而且报的错误如下:
com.alibaba.dubbo.remoting.RemotingException: client(url: dubbo://192.168.1.131:20880.........
192.168.1.131是我本地机子的内网ip。
阿里云和我本地机子的防火墙是关闭的。
consumerr配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<dubbo:application name="apitest" />
<dubbo:consumer timeout="6000" />

<dubbo:registry address="zookeeper://阿里云地址:2181?buckup=阿里云地址:2182" />

<dubbo:reference id="baseService" interface="com.lmiky.platform.service.BaseService" timeout="6000" />

</beans>

provider配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

<dubbo:application name="platform-servise" />
<dubbo:provider timeout="6000"/>


<dubbo:registry address="zookeeper://阿里云地址:2181?buckup=阿里云地址:2182" />

<dubbo:protocol name="dubbo" port="20880"/>

<dubbo:service interface="com.lmiky.platform.service.BaseService" ref="baseService" />
</beans>
...全文
1159 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
骷髅鱼 2017-06-16
  • 打赏
  • 举报
回复
我也是跟楼主一样,本地怎么玩儿都没事,阿里云上怎么玩儿都没事,但是本地的consumer消费端去调部署在阿里云上的provider就出现问题了,我是在阿里云上的provider工程的spring文件中<dubbo:protocol name="dubbo" port="20880" /> 里加上host="阿里云的ip" 解决问题 PS:也请注意阿里云上的防火墙/端口是否开放等问题..
空白-键 2015-10-23
  • 打赏
  • 举报
回复
引用 7 楼 shijing266 的回复:
不会啊,我之前弄过一个,配置什么的跟你一样,同样本地能访问服务器,中间出过问题,是因为telnet 不通,端口被限制了 帮你顶顶,看其他大神解答吧
哎,自己顶下,也可能是我服务器有什么问题吧,等有时间了在看看
空白-键 2015-10-22
  • 打赏
  • 举报
回复
那该怎么办,应该不是dubbo自身有这限制吧
  • 打赏
  • 举报
回复
引用 6 楼 linminqin 的回复:
那该怎么办,应该不是dubbo自身有这限制吧
不会啊,我之前弄过一个,配置什么的跟你一样,同样本地能访问服务器,中间出过问题,是因为telnet 不通,端口被限制了 帮你顶顶,看其他大神解答吧
  • 打赏
  • 举报
回复
看你的配置是没问题的
空白-键 2015-10-21
  • 打赏
  • 举报
回复
引用 3 楼 shijing266 的回复:
[quote=引用 2 楼 linminqin 的回复:] [quote=引用 1 楼 shijing266 的回复:] 你本地ping服务器的ip能ping通么?
恩,能ping的通[/quote] 能Ping 通,你telnet一下,看看ip和端口是不是通的 。[/quote] 也能ping的通,我防火墙是关闭的
  • 打赏
  • 举报
回复
引用 2 楼 linminqin 的回复:
[quote=引用 1 楼 shijing266 的回复:] 你本地ping服务器的ip能ping通么?
恩,能ping的通[/quote] 能Ping 通,你telnet一下,看看ip和端口是不是通的 。
空白-键 2015-10-21
  • 打赏
  • 举报
回复
引用 1 楼 shijing266 的回复:
你本地ping服务器的ip能ping通么?
恩,能ping的通
  • 打赏
  • 举报
回复
你本地ping服务器的ip能ping通么?

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧