- 浏览: 429361 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (211)
- 思考》感想 (11)
- 数据库操作 譬如Oracle大叔 (7)
- java,咱们有缘吗 (16)
- delphi,你还好吗 (2)
- SSH,哥三儿好 (31)
- 问题!问题?问题!? (9)
- WITH WORK (1)
- 算法与模式 莫事^_^ (10)
- JSP,可以叫你P兄么 (2)
- 啊,咋科斯╮(╯▽╰)╭ (6)
- 巨人肩上的小石子 (2)
- flash她妹flex (38)
- 项目管理 (10)
- 奥特曼,你弟Android来了 (4)
- 麻辣儿gis (0)
- maven 嘛味儿 (3)
- ws 哇塞 webservice (5)
- Oh,no!!!,NoSql (1)
- QQ他哥也是个企鹅,Linux (6)
- 姓i还是姓my 你都叫batis ibatis (3)
- 我喜欢夏天(春天旁边的那个季节)Springside (1)
- 测试! 测就测吧,没有喝(⊙o⊙) (3)
- 是晕+_+ 是浮云 还是云计算 (4)
- ExtJS 你是flex他哥还是他妹 (10)
- svg 你丫的资料真少 (3)
- 叫屁屁还是叫加加 ⊙﹏⊙ c++ (5)
- 鸟,还是只百灵鸟 BIRT (1)
- 权限管理 有权真好 是吧-_-! (1)
- SSH (2)
- 哥三儿好 (2)
- nginx (1)
- Oh (1)
- no!!! (1)
- NoSql (1)
最新评论
-
mong619226543:
谢谢
No identifier specified for entity -
akka_li:
没看懂啥意思!什么原因导致java.net.SocketExc ...
java.net.SocketException: Connection reset 问题解决方法 -
west_jing:
1L正解,<mvc:annotation-driven/ ...
<mvc:default-servlet-handler/> 导致 Controller失效 -
u010954806:
tgfhfdhdf
Spring Security 国际化文件 messages_zh_CN.properties 中文解释 -
yenshen:
我也碰到这个问题了,找了一大圈,最终问题解决了:<con ...
<mvc:default-servlet-handler/> 导致 Controller失效
你好 dubbo他弟:dubbox
---》下载dubbox
* dubbox扩展了dubbo,采用dubbox进行测试
* 地址:https://github.com/dangdangdotcom/dubbox
* 文档参考dubbo的文档,写的很详细。http://dubbo.io/User+Guide-zh.htm
---》编译dubbox
* mvn clean install -Dmaven.test.skip
* dubbox编译没啥问题,碰到问题可以再尝试编译一次,dubbo会遇到一些确库的问题,但网上都有解决方案;
---》安装zookeeper
* 大数据里必用的一个东东,也用到了这里,too strong!
* 下载:http://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.8/
* 解压
* 配置,
创建文件zoo.cfg,添加如下内容,dataDir和:dataLogDir改为自己的路径
tickTime=2000
initLimit=10
syncLimit=5
dataDir=D:/java/zookeeper-3.4.6/data
dataLogDir=D:/java/zookeeper-3.4.6/log
clientPort=2181
server.1=localhost:2287:3387
然后输入 bin/zkServer.cmd 启用zookeeper
---》撰写demo
* dubbox自带了demo,可以查看,比较复杂点,dubbo的比较简单,也有说明文档。
* 创建三个工程 myDubbox-api(开放的api)、myDubbox-provider(服务提供端)、myDubbox-consumer(服务调用端)
************ myDubbox-api 中代码************
》HelloService接口
public interface HelloService {
String hello(String name);
}
************ myDubbox-provider 中的主要代码 ************
》HelloServiceImpl实现类
public class HelloServiceImpl implements HelloService {
public String hello(String name) {
return "hello " + name;
}
}
》 DemoProvider (负责启动服务)
public class DemoProvider {
public static void main(String[] args) throws IOException {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:/*.xml");
context.start();
System.out.println("服务已经启动...");
System.in.read();
}
}
》pom.xml 文件(myDubbox-api为依赖的api jar包)
<dependencies>
<dependency>
<groupId>com.xxx</groupId>
<artifactId>myDubbox-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
》duboox、spring相关配置文件(dubbo:registry为zookeeper的地址)
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="demo-provider" owner="programmer" organization="dubbox"/>
<dubbo:registry address="zookeeper://192.168.10.123:2181"/>
<!-- 声明需要暴露的服务接口 -->
<dubbo:service interface="com.xxx.demo.service.HelloService" ref="helloService" />
<!-- 和本地bean一样实现服务 -->
<bean id="helloService" class="com.xxx.demo.service.impl.HelloServiceImpl" />
</beans>
》log4j文件
略
************ myDubbox-consumer工程主要代码 ************
》Consumer(负责调用服务)
public class Consumer {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"dubbo-demo-consumer.xml"});
context.start();
HelloService demoService = (HelloService)context.getBean("helloService"); // 获取远程服务代理
String hello = demoService.hello("world"); // 执行远程方法
System.out.println( hello ); // 显示调用结果
}
}
》duboox、spring相关配置文件(dubbo:registry为zookeeper的地址)
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="demo-consumer" owner="programmer" organization="dubbox"/>
<dubbo:registry address="zookeeper://192.168.10.123:2181"/>
<dubbo:reference id="helloService" interface="com.xxx.demo.service.HelloService"/>
</beans>
》log4j文件
略
---》测试
* 运行DemoProvider注册服务
INFO [2016-05-25 16:57:35,354] com.alibaba.dubbo.registry.support.AbstractRegistry.register(302) | [DUBBO] Register: dubbo://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067, dubbo version: 2.8.4, current host: 127.0.0.1
INFO [2016-05-25 16:57:35,482] com.alibaba.dubbo.registry.support.AbstractRegistry.subscribe(325) | [DUBBO] Subscribe: provider://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067, dubbo version: 2.8.4, current host: 127.0.0.1
INFO [2016-05-25 16:57:35,590] com.alibaba.dubbo.registry.support.AbstractRegistry.notify(422) | [DUBBO] Notify urls for subscribe url provider://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067, urls: [empty://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067], dubbo version: 2.8.4, current host: 127.0.0.1
服务已经启动...
* 运行Consumer查看调用结果
INFO [2016-05-25 17:00:12,170] com.alibaba.dubbo.remoting.transport.AbstractClient.<init>(105) | [DUBBO] Start NettyClient yaoningpo/192.168.10.123 connect to the server /192.168.10.123:20880, dubbo version: 2.8.4, current host: 192.168.10.123
INFO [2016-05-25 17:00:12,208] com.alibaba.dubbo.config.ReferenceConfig.createProxy(423) | [DUBBO] Refer dubbo service com.xxx.demo.service.HelloService from url zookeeper://192.168.10.123:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=demo-consumer&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=2500&side=consumer×tamp=1464166811509, dubbo version: 2.8.4, current host: 192.168.10.123
hello world
---》部署 dubbo-admin,查看服务部署和调用情况
* 把dubbo-admin-2.8.4.war 部署到tomcat
* 修改 \dubbo-admin-2.8.4\WEB-INF\dubbo.properties 下的dubbo.registry.address
* 此文件还可以配置登录密码
参考:
http://www.cnblogs.com/yjmyzz/p/dubbox-demo.html
http://blog.csdn.net/ggibenben1314/article/details/47725241
---》下载dubbox
* dubbox扩展了dubbo,采用dubbox进行测试
* 地址:https://github.com/dangdangdotcom/dubbox
* 文档参考dubbo的文档,写的很详细。http://dubbo.io/User+Guide-zh.htm
---》编译dubbox
* mvn clean install -Dmaven.test.skip
* dubbox编译没啥问题,碰到问题可以再尝试编译一次,dubbo会遇到一些确库的问题,但网上都有解决方案;
---》安装zookeeper
* 大数据里必用的一个东东,也用到了这里,too strong!
* 下载:http://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.8/
* 解压
* 配置,
创建文件zoo.cfg,添加如下内容,dataDir和:dataLogDir改为自己的路径
tickTime=2000
initLimit=10
syncLimit=5
dataDir=D:/java/zookeeper-3.4.6/data
dataLogDir=D:/java/zookeeper-3.4.6/log
clientPort=2181
server.1=localhost:2287:3387
然后输入 bin/zkServer.cmd 启用zookeeper
---》撰写demo
* dubbox自带了demo,可以查看,比较复杂点,dubbo的比较简单,也有说明文档。
* 创建三个工程 myDubbox-api(开放的api)、myDubbox-provider(服务提供端)、myDubbox-consumer(服务调用端)
************ myDubbox-api 中代码************
》HelloService接口
public interface HelloService {
String hello(String name);
}
************ myDubbox-provider 中的主要代码 ************
》HelloServiceImpl实现类
public class HelloServiceImpl implements HelloService {
public String hello(String name) {
return "hello " + name;
}
}
》 DemoProvider (负责启动服务)
public class DemoProvider {
public static void main(String[] args) throws IOException {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:/*.xml");
context.start();
System.out.println("服务已经启动...");
System.in.read();
}
}
》pom.xml 文件(myDubbox-api为依赖的api jar包)
<dependencies>
<dependency>
<groupId>com.xxx</groupId>
<artifactId>myDubbox-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>2.8.4</version>
</dependency>
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
》duboox、spring相关配置文件(dubbo:registry为zookeeper的地址)
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="demo-provider" owner="programmer" organization="dubbox"/>
<dubbo:registry address="zookeeper://192.168.10.123:2181"/>
<!-- 声明需要暴露的服务接口 -->
<dubbo:service interface="com.xxx.demo.service.HelloService" ref="helloService" />
<!-- 和本地bean一样实现服务 -->
<bean id="helloService" class="com.xxx.demo.service.impl.HelloServiceImpl" />
</beans>
》log4j文件
略
************ myDubbox-consumer工程主要代码 ************
》Consumer(负责调用服务)
public class Consumer {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"dubbo-demo-consumer.xml"});
context.start();
HelloService demoService = (HelloService)context.getBean("helloService"); // 获取远程服务代理
String hello = demoService.hello("world"); // 执行远程方法
System.out.println( hello ); // 显示调用结果
}
}
》duboox、spring相关配置文件(dubbo:registry为zookeeper的地址)
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="demo-consumer" owner="programmer" organization="dubbox"/>
<dubbo:registry address="zookeeper://192.168.10.123:2181"/>
<dubbo:reference id="helloService" interface="com.xxx.demo.service.HelloService"/>
</beans>
》log4j文件
略
---》测试
* 运行DemoProvider注册服务
INFO [2016-05-25 16:57:35,354] com.alibaba.dubbo.registry.support.AbstractRegistry.register(302) | [DUBBO] Register: dubbo://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067, dubbo version: 2.8.4, current host: 127.0.0.1
INFO [2016-05-25 16:57:35,482] com.alibaba.dubbo.registry.support.AbstractRegistry.subscribe(325) | [DUBBO] Subscribe: provider://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067, dubbo version: 2.8.4, current host: 127.0.0.1
INFO [2016-05-25 16:57:35,590] com.alibaba.dubbo.registry.support.AbstractRegistry.notify(422) | [DUBBO] Notify urls for subscribe url provider://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067, urls: [empty://192.168.10.123:20880/com.xxx.demo.service.HelloService?anyhost=true&application=demo-provider&category=configurators&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=8888&side=provider×tamp=1464166655067], dubbo version: 2.8.4, current host: 127.0.0.1
服务已经启动...
* 运行Consumer查看调用结果
INFO [2016-05-25 17:00:12,170] com.alibaba.dubbo.remoting.transport.AbstractClient.<init>(105) | [DUBBO] Start NettyClient yaoningpo/192.168.10.123 connect to the server /192.168.10.123:20880, dubbo version: 2.8.4, current host: 192.168.10.123
INFO [2016-05-25 17:00:12,208] com.alibaba.dubbo.config.ReferenceConfig.createProxy(423) | [DUBBO] Refer dubbo service com.xxx.demo.service.HelloService from url zookeeper://192.168.10.123:2181/com.alibaba.dubbo.registry.RegistryService?anyhost=true&application=demo-consumer&check=false&dubbo=2.8.4&generic=false&interface=com.xxx.demo.service.HelloService&methods=hello&organization=dubbox&owner=programmer&pid=2500&side=consumer×tamp=1464166811509, dubbo version: 2.8.4, current host: 192.168.10.123
hello world
---》部署 dubbo-admin,查看服务部署和调用情况
* 把dubbo-admin-2.8.4.war 部署到tomcat
* 修改 \dubbo-admin-2.8.4\WEB-INF\dubbo.properties 下的dubbo.registry.address
* 此文件还可以配置登录密码
参考:
http://www.cnblogs.com/yjmyzz/p/dubbox-demo.html
http://blog.csdn.net/ggibenben1314/article/details/47725241
发表评论
-
对hashcode和equals的深度理解
2015-08-04 19:46 594对hashcode和equals的深度理解 ---》一个例子 ... -
一个很不错的多线程学习网站
2015-07-18 14:59 555一个很不错的多线程学习网站 此网站“充斥”了大量多线程支持,有 ... -
判断字符串是否含有中文字符的三种方法
2012-11-02 11:22 1804//判断字符串是否含有中文字符的三种方法,正则表达式不能判断标 ... -
Java的参数传递总结
2011-06-15 11:39 1144Java的参数传递总结 JAVA的参数传递总是传&quo ... -
import static和import的区别?
2011-05-27 16:04 943import static和import的区别? ----- ... -
source folder突然间的疑问
2011-05-20 15:40 1206source folder突然间的疑问 在做测试的时候,因为 ... -
java.net.SocketException: Connection reset 问题解决方法
2010-11-11 15:00 20605java.net.SocketException: Conne ... -
myEclipse注册码
2010-02-16 11:55 1022现在myEclipse官网上不去了?!也被河西了吗? 代码如下 ... -
dom4j操作
2009-10-19 18:04 1073本文主要讨论了用dom4j解析XML的基础问题,包括建立XML ... -
一个递归
2009-07-15 22:53 1040public List<Integer>getS ... -
web.xml文件配置说明
2009-06-07 19:51 1139以下是web.xml文件配置的详细说明 <?x ... -
再一次理解String
2009-05-09 16:39 973偶然看到了篇关于String的文章,发现以前学的都忘了 ,所以 ... -
一些常见问题
2009-05-09 09:36 1001第一,谈谈final, finally, finalize的区 ... -
自问自答(1) 2008-6-15
2008-06-15 22:03 10781、静态方法中的成员变量为什么必须是静态的?静态方法意味着首先 ... -
(转)提高自己JAVA水平的十大技术讨论
2008-06-23 08:34 895本文列出了当今计算机 ...
相关推荐
附件为:dubbox2.8.4 maven依赖文件。 使用方法:按照依赖关系,自行创建maven依赖文件夹后,将附件解压至指定文件夹即可使用。 可解决Missing artifact com.alibaba:dubbo:jar:2.8.4 dubbo问题。
dubbo 基于dubbox 2.8.4 编译
dubbo服务监控 目录包含: dubbo-admin dubbo-monitor-simple dubbo-registry-simple pom.xml README.md
可用
dubbo开发eclipse配置需要dubbo开发eclipse配置需要dubbo开发eclipse配置需要
dubbox 修改了kryo序列问题 at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:190) at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get...
jdk1.7.0_13,win7 x86 环境下编译的 dubbox 2.8.4
dubbo-2.8.4.jar,dubbo-admin.war ,dubbo-monitor,dubbo.xsd,dubbox-master.zip
dubbox2.8.4版本,增强dubbox功能,由当当网开源出来,maven构建!
dubbo admin 管理控制台 基于dubbox 2.8.4 编译
dubbox源码:dubbox-master-2.8.4.zip源码 dubbo.xsd 文件:dubbo-opensesame-master-xsd-20170815.zip 服务提供和消费源码demo:provider.rar 可部署dubbo-admin包:dubbo-admin-2.8.4.war 可部署dubbo-...
dubbox-dubbox-2.8.4 源码 dubbox-dubbox-2.8.4 源码 下载
1. 本地启动 Nacos Server、Provider、Consumer,触发 Consumer 调用 Provider 2. kill -9 Nacos
java二进制补码源码Dubbo是一个来自阿里巴巴的开源分布式服务框架,当当根据自身的需求,为Dubbo实现了一些新的功能,包括REST风格远程调用、Kryo/FST序列化等等,并将其命名为Dubbox。 Demo:类似范例: ##Dubbo...
DUBBO-POSTMAN DUBBO-POSTMAN: 一个用于通过web-ui页面访问dubbo接口的工具,灵感源于 介绍 DUBBO-POSTMAN 是一个通过web页面访问dubbo接口的开源工具,包括零代码创建一个dubbo consumer,保存访问用例,构建场景测试. ...
Dubbox环境搭建,安装包dubbox-master,dubbox-master,以及详细dubboxDemo和详细配置文档
2. dubbo-2.8.4其实就是dubbox 当当网在开发dubbox时,是在dubbo的基础上,所以沿用了版本号,但没有上传到maven的中央仓库,所以这里需要自己手动安装到仓库中 3. 此jar也是视频教程品优购项目中所要求的的dubbox...