weibocom / motan

A cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.
Other
5.9k stars 1.78k forks source link

如何实现多个服务暴露在同一个端口上 #520

Open maxyongsheng opened 7 years ago

maxyongsheng commented 7 years ago

暴露多个服务时,配置同一端口会报错,说地址已bind。 如何在同一个端口上暴露多个服务呢?

maxyongsheng commented 7 years ago
<bean id="commodityService" class="com.jinqiandun.store.commodity.impl.CommodityServiceImpl" />
<bean id="shopCartService" class="com.jinqiandun.store.shopcart.impl.ShopCartServiceImpl" />
<!-- exporting service by motan -->
<motan:protocol name="motan" id="coreMotan"/>
<motan:basicService id="serviceBasicConfig" group="motan-core-rpc" module="motan-core-rpc" registry="my_zookeeper" export="coreMotan:21888"/>
<motan:registry  requestTimeout="5000" connectTimeout="5000"  regProtocol="zookeeper" name="my_zookeeper" address="${dubbo.zk.address}"/>

<motan:service interface="com.jinqiandun.store.commondity.service.CommodityService" ref="commodityService" basicService="serviceBasicConfig"/>
<motan:service interface="com.jinqiandun.store.shopcart.service.ShopCartService" ref="shopCartService" basicService="serviceBasicConfig"/>

报错: Caused by: java.net.BindException: Address already in use: bind

rayzhang0603 commented 7 years ago

请参考https://github.com/weibocom/motan/issues/72