dubbox 发布rest服务调用过程记录
来源:互联网 发布:ddos攻击器软件 编辑:程序博客网 时间:2024/06/06 04:25
<?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:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 提供方应用信息,用于计算依赖关系 --> <dubbo:application name="HSFServiceA"/> <!-- 使用zookeeper统一管理 --> <dubbo:registry protocol="zookeeper" address="192.168.136.129:2181" /> <!-- 不同协议在不同端口暴露服务 --> <!-- <dubbo:protocol id="dubbo" name="dubbo" port="31106" accesslog="E:\\logs\\hsf\\hsfserverA.log" /> --> <dubbo:protocol id="rest" name="rest" port="8080" server="servlet" contextpath="HSFServiceA" accesslog="E:\\logs\\hsf\\hsfserverA.log"/><bean id="ServiceAImpl" class="com.services.impl.ServiceAImpl" ></bean><dubbo:service interface="com.services.ServiceA" ref="ServiceAImpl" loadbalance="random" timeout="30000" executes="10" ></dubbo:service></beans>
最近在使用dubbox作开发,发布为rest服务,服务起动进使用server=servlet这个模式,但是在调用时怎么也调用不通,所以一直在找原因,上面是服务的xml配置文件,下面是调用者的xml配置文件:
<?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:dubbo="http://code.alibabatech.com/schema/dubbo" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"><!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 --><dubbo:application name="HSFClient" /><!-- 注册中心地址 --><dubbo:registry protocol="zookeeper" address="192.168.136.129:2181" /><dubbo:protocol id="rest" name="rest" /><!-- 生成远程服务代理,可以和本地bean一样使用 --><dubbo:reference id="ServiceA" interface="com.services.ServiceA" /></beans>
最后发现是tomcat中server.xml中配置的connector中指定的ip是192.168开头的内部地址,所以通过外网ip获取请求时出错。需要注意的是当使用server=servlet时,port要和外置容器的port一致,而且contextpath要以外置容器的访问路径保持正确的关系,比如我这里是HSFServiceA,那么contextpath要以HSFServiceA开头。
阅读全文
2 0
- dubbox 发布rest服务调用过程记录
- dubbox rest调用过程分析
- dubboX提供rest服务
- dubbox为dubbo提供REST服务(dubbox + springmvc)
- Tuscany发布REST服务
- springmvc发布rest服务
- dubbox+rest详细介绍
- dubbox rest学习
- ArcGIS Server 发布 REST 服务
- ArcGIS Server 发布 REST 服务
- 14_CXF发布REST服务
- Jersey 发布rest服务接口
- ArcGIS Engine 调用Rest服务
- JQuery调用Rest服务接口
- JAVA调用Rest服务接口
- 手机调用ArcGIS Server发布的Rest地图服务不显示问题
- java调用arcgis soe发布的rest服务,中文传值乱码问题
- CXF系列之JAX-RS:CXF发布与调用REST服务
- BZOJ 3224: Tyvj 1728 普通平衡树 pb_ds
- hdu6103
- 最全的jquery datatables api 使用详解
- 矩阵A+B
- 小X的佛光
- dubbox 发布rest服务调用过程记录
- Spring事务机制详解
- 关于app目前第三方托管平台整理
- SpringCloud教程 | 第三篇: 服务消费者(Feign)
- emWin 2天速成实例教程-000
- cve_details按照时间爬取(pyspider)
- 三、高并发秒杀API之Service层设计与实现
- 【POJ
- 牛客网优惠码-直通BAT面试算法精品课购买