activeMQ networkConnectors

          最近在学习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.

             On Windows:

             From a console window, change to the installation directory and run ActiveMQ:

                cd [activemq_install_dir]

            where activemq_install_dir is the directory in which ActiveMQ was installed, e.g., c:\Program Files\ActiveMQ-5.x.
           Then type:

                 bin\activemq

           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

          On Windows

            From a console window, change to the installation directory and run ActiveMQ:

     cd [activemq_install_dir]

            where activemq_install_dir is 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

         bin\activemq start

            ActiveMQ 5.9 or older

         bin\activemq

       

           恍然大悟,原来新的MQ应该是用activemq start来启动的,再加了xbean,成功启动

              但是错误除了重复的bean外,还显示找不到networkConnectors这个标记?

               为什么呢?

               网上查看了资料,原文如下:

                I ran into the same problem.  The networkConnectors need to be first in the XML declaration.

                调整了下顺序,果然成功运行了!



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值