activeMQ networkConnectors
2016-04-20 16:39
197 查看
最近在学习activeMQ,看的是 activemq in Action这本书,当读到4.5章节Network connnectors时遇到了一点问题,折腾了几天才解决,写下心得
书中看到这里:
activemq xbean:src/main/resources/org/apache/activemq/book/ch4/brokerA.xml
当我打开cmd,运行此命令时没有报错,一切正常,但当我启动consumer时,却找不到61617的监听,但是brokerA.xml中明明已经配置
<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost:61616" />
</transportConnectors>
<networkConnectors>
<networkConnector uri="static:(tcp://localhost:61617)" />
</networkConnectors>
什么问题呢?难道是自己指定的xbean的路径有问题,所以故意在brokerA.xml中再加载一个
<transprotConnector name="openwire" uri="tcp://localhost;61616"/>
如果能加载到,那么这两个bean相同,应该会报错,但是还是成功启动,没有任何错误,那肯定就是根本没有加载到这个配置文件了,反复试验,用各种方法都加载不到。网上查看资料也找不到对应的。最后本人怀疑起一件事情:
书中的原代码用的是activeMQ5.3.2的,本人用的是activeMQ5.13的,会不会是最新的activeMQ已经把xbean这个命令去掉了,索性下载一个5.4的,再加载,报错。起初我认为最新的5.13应该是不支持xbean这种加载方法。然后心里面还是不踏实,觉得如果不支持xbean这种方法的加载,只能默认加载activemq.xml那启不是activemq的一种倒退,查阅资料,还是解不开问题。等到第二天,我又下载了5.10这个版本,还是不行,仍然不能下载用xbean加载到别的配置文件。
难道我只能用5.4这个版本,要知道这个版本对应的spring可是2.X,现在的spring基本都是3.X,仍然心有不甘。
最后登陆acitveMQ的官网http://activemq.apache.org/getting-started.html
看到上面启动MQ的方法是这样的
Starting ActiveMQ
There now follows instructions on how to
run the ActiveMQ Message Broker.
where
Then type:
NOTE: Working directories get created relative to the current directory. To create working directories in the proper place, ActiveMQ must be launched from its home/installation directory.
而本人用的是64们操作系统,一直认为是bin\win64\activemq
换成这种方法,cmd里只是显示很多内容,根本没有启动,加上xbean仍然启动不了,这是为什么呢,难道官网介绍也有错误,想了下,这些5.x应该有新命令,
浏览了这里 http://activemq.apache.org/version-5-getting-started.html
where
Then type (depending on ActiveMQ version):
ActiveMQ 5.10 onwards
ActiveMQ 5.9 or older
恍然大悟,原来新的MQ应该是用activemq start来启动的,再加了xbean,成功启动
但是错误除了重复的bean外,还显示找不到networkConnectors这个标记?
为什么呢?
网上查看了资料,原文如下:
I ran into the same problem. The networkConnectors need to be first in the XML declaration.
调整了下顺序,果然成功运行了!
书中看到这里:
activemq xbean:src/main/resources/org/apache/activemq/book/ch4/brokerA.xml
当我打开cmd,运行此命令时没有报错,一切正常,但当我启动consumer时,却找不到61617的监听,但是brokerA.xml中明明已经配置
<!-- The transport connectors ActiveMQ will listen to -->
<transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost:61616" />
</transportConnectors>
<networkConnectors>
<networkConnector uri="static:(tcp://localhost:61617)" />
</networkConnectors>
什么问题呢?难道是自己指定的xbean的路径有问题,所以故意在brokerA.xml中再加载一个
<transprotConnector name="openwire" uri="tcp://localhost;61616"/>
如果能加载到,那么这两个bean相同,应该会报错,但是还是成功启动,没有任何错误,那肯定就是根本没有加载到这个配置文件了,反复试验,用各种方法都加载不到。网上查看资料也找不到对应的。最后本人怀疑起一件事情:
书中的原代码用的是activeMQ5.3.2的,本人用的是activeMQ5.13的,会不会是最新的activeMQ已经把xbean这个命令去掉了,索性下载一个5.4的,再加载,报错。起初我认为最新的5.13应该是不支持xbean这种加载方法。然后心里面还是不踏实,觉得如果不支持xbean这种方法的加载,只能默认加载activemq.xml那启不是activemq的一种倒退,查阅资料,还是解不开问题。等到第二天,我又下载了5.10这个版本,还是不行,仍然不能下载用xbean加载到别的配置文件。
难道我只能用5.4这个版本,要知道这个版本对应的spring可是2.X,现在的spring基本都是3.X,仍然心有不甘。
最后登陆acitveMQ的官网http://activemq.apache.org/getting-started.html
看到上面启动MQ的方法是这样的
Starting ActiveMQ
There now follows instructions on how to
run the ActiveMQ Message Broker.
On Windows:
From a console window, change to the installation directory and runActiveMQ:
activemq_install_diris the directory in which ActiveMQ was installed, e.g.,
c:\Program Files\ActiveMQ-5.x.
Then type:
而本人用的是64们操作系统,一直认为是bin\win64\activemq
换成这种方法,cmd里只是显示很多内容,根本没有启动,加上xbean仍然启动不了,这是为什么呢,难道官网介绍也有错误,想了下,这些5.x应该有新命令,
浏览了这里 http://activemq.apache.org/version-5-getting-started.html
On Windows
From a console window, change to the installation directory and runActiveMQ:
activemq_install_diris the directory in which ActiveMQ was installed, e.g.,
c:\Program Files\ActiveMQ-5.x.
Then type (depending on ActiveMQ version):
ActiveMQ 5.10 onwards
但是错误除了重复的bean外,还显示找不到networkConnectors这个标记?
为什么呢?
网上查看了资料,原文如下:
I ran into the same problem. The networkConnectors need to be first in the XML declaration.
调整了下顺序,果然成功运行了!
相关文章推荐
- NSDate计算两个时间日期的时差
- ScrollView中软键盘弹出依然遮住控件
- DataTables错误: requested unknown parameter
- WebService和Webapi的区别
- 正确使用 Volatile 变量
- 基于asp.net+MINIUI的项目----在线学习系统
- 是否需要主动调用Bitmap的recycle方法
- JVM基础(二) 实现自己的ClassLoader
- ZooKeeper 安装部署及hello world
- [置顶] [汇编学习笔记][第六章包含多个段的程序]
- 【python】read_csv+编码问题
- [汇编学习笔记][第六章包含多个段的程序]
- 大中型Web站点解决高并发访问的优化方案
- Android 如何加载大图片
- --force
- spring事务管理
- C++里的继承和多态(下)——单继承、多继承、菱形继承(含虚拟函数的继承)
- 投简历,切忌这三大雷区!
- 腾讯2016校招技术岗面试经历
- iOS APP 发布上架流程