尽管代理URL中有0.0.0.0,ActiveMQ远程连接仍被拒绝

尽管代理URL中有0.0.0.0,ActiveMQ远程连接仍被拒绝,activemq,apache-karaf,blueprint-osgi,Activemq,Apache Karaf,Blueprint Osgi,我有一个运行在Karaf v2.3.3中的ActiveMQ v5.7.0代理,我想为远程连接启用它。我已将代理URL设置为0.0.0.0:61616,以使其能够侦听网络流量。我已经打开了防火墙,允许来自客户端机器的流量。但是,所有远程连接都被拒绝。一个快速的netstat似乎告诉我代理没有在localhost之外监听 jeremy@server:~$ netstat -pan | grep 61616 tcp6 0 0 127.0.0.1:61616 :::

我有一个运行在Karaf v2.3.3中的ActiveMQ v5.7.0代理,我想为远程连接启用它。我已将代理URL设置为0.0.0.0:61616,以使其能够侦听网络流量。我已经打开了防火墙,允许来自客户端机器的流量。但是,所有远程连接都被拒绝。一个快速的netstat似乎告诉我代理没有在localhost之外监听

jeremy@server:~$ netstat -pan | grep 61616
tcp6       0      0 127.0.0.1:61616         :::*                    LISTEN      -               
2013-10-14 17:34:29 Connected to localhost:61613
查看代理via告诉我URL看起来应该是这样的

Transport connectors    Openwire: tcp://0.0.0.0:61616?maximumConnections=1000&wireformat.maxFrameSize=104857600
防火墙是绝对正常的,因为连接被拒绝而不是被丢弃

代理正确响应本地主机的连接

jeremy@server:~$ netstat -pan | grep 61616
tcp6       0      0 127.0.0.1:61616         :::*                    LISTEN      -               
2013-10-14 17:34:29 Connected to localhost:61613
这是我从远程连接中得到的一种错误:-

Error connecting to xxx.xxx.xxx.xxx:61613: IO::Socket::INET: connect: Connection refused at /usr/local/share/perl/5.14.2/Net/Stomp.pm line 102.
编辑:添加telnet输出

2013-10-15 19:00:46,599 | ERROR | c.event.invited] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer  909 | 69 - org.springframework.jms - 3.2.4.RELEASE | Could not refresh JMS Connection for destination 'Consumer.notifications.VirtualTopic.event.invited' - retrying in 5000 ms. Cause: Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://xxx.xxx.xxx.xxx:61616. Reason: java.net.ConnectException: Connection refused
本地主机端口61613

jeremy@server:~$ telnet localhost 61613
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
jeremy@other-server:~$ telnet xxx.xxx.xxx.xxx 61613
Trying xxx.xxx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused
远程连接端口613

jeremy@server:~$ telnet localhost 61613
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
jeremy@other-server:~$ telnet xxx.xxx.xxx.xxx 61613
Trying xxx.xxx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused
本地主机连接端口61616(这一个很有趣)

远程连接端口61616

jeremy@other-server:~$ telnet xxx.xxx.xxx.xxx 61616
Trying xxx.xxx.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused
编辑:添加了远程服务器卡拉夫日志输出

2013-10-15 19:00:46,599 | ERROR | c.event.invited] | faultJmsMessageListenerContainer | .DefaultMessageListenerContainer  909 | 69 - org.springframework.jms - 3.2.4.RELEASE | Could not refresh JMS Connection for destination 'Consumer.notifications.VirtualTopic.event.invited' - retrying in 5000 ms. Cause: Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://xxx.xxx.xxx.xxx:61616. Reason: java.net.ConnectException: Connection refused
这是broker.xml

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
  xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
  xmlns:amq="http://activemq.apache.org/schema/core">

  <ext:property-placeholder />

  <broker xmlns="http://activemq.apache.org/schema/core"
    brokerName="jellyfish-messaging"
    dataDirectory="${karaf.data}/activemq/localhost"
    useShutdownHook="false"
    persistent="true"
    schedulerSupport="true"
    startAsync="true">

    <destinationPolicy>
      <policyMap>
        <policyEntries>
          <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
            <pendingSubscriberPolicy>
              <vmCursor />
            </pendingSubscriberPolicy>
          </policyEntry>
          <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
          </policyEntry>
        </policyEntries>
      </policyMap>
    </destinationPolicy> 

    <persistenceAdapter>
      <kahaDB directory="${karaf.data}/activemq/localhost/kahadb"/>
    </persistenceAdapter>

    <systemUsage>
        <systemUsage>
            <memoryUsage>
                <memoryUsage limit="64 mb"/>
            </memoryUsage>
            <storeUsage>
                <storeUsage limit="100 gb"/>
            </storeUsage>
            <tempUsage>
                <tempUsage limit="50 gb"/>
            </tempUsage>
        </systemUsage>
    </systemUsage>

    <!-- The transport connectors ActiveMQ will listen to -->
    <transportConnectors>
        <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
        <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
        <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
    </transportConnectors>

  </broker>

  <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://0.0.0.0:61616" />
  </bean>

  <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
    <property name="maxConnections" value="8" />
    <property name="maximumActive" value="500" />
    <property name="connectionFactory" ref="jmsConnectionFactory" />
  </bean>

  <bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
    <property name="transactionManager" ref="transactionManager" />
    <property name="connectionFactory" ref="jmsConnectionFactory" />
    <property name="resourceName" value="activemq.localhost" />
  </bean>

  <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="pooledConnectionFactory" />
    <property name="transacted" value="false" />
    <property name="concurrentConsumers" value="10" />
  </bean>

  <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
    <property name="configuration" ref="jmsConfig" />
  </bean>

  <reference id="transactionManager" interface="javax.transaction.TransactionManager" />

  <service ref="pooledConnectionFactory" interface="javax.jms.ConnectionFactory">
    <service-properties>
      <entry key="name" value="localhost"/>
    </service-properties>
  </service>
</blueprint>

谁能告诉我我错过了什么

谢谢


J.

我已经解决了这个问题。这既不是防火墙的问题,也不是ActiveMQ配置的问题

定义ActiveMQ代理的Karaf kar文件包括ActiveMQ web控制台功能。我们没有使用这个功能,因为我们是Hawtio的粉丝,所以从未配置过

根据,控制台提供了默认设置,包括监听端口616。这意味着两名经纪人在创业时处于竞争状态,而webconsole定义的一名经纪人通常获胜。由于默认情况下它没有配置为远程访问,因此它只锁定本地主机连接的端口

赠品是Karaf主目录中名为${activemq.data}(字面意思)的目录,其中包含第二个Kahadb存储库。我们所有的代理配置都设置为使用数据目录,并且我们从来没有专门设置ActiveMQ环境变量,因此这让我们寻找第二个代理可能来自何处

如果我们在Karaf会话中执行activemq:list,可能会更快地发现它,因为它列出了两个代理


简单解决方案-从功能XML中删除activemq web控制台。

您可以尝试从本地和远程主机远程登录到61613和61616,并将输出添加到问题中吗?从activemq配置的角度来看,这一切看起来都正常。这绝对像是一个防火墙问题——如果你在Linux机器上,你可能有一个本地的,比如iptables在运行。Telnetting到JMX(1099)应该可以证实这一点——在任何配置中都没有任何东西可以阻止它与远程设备的连接。谢谢——我已经回顾了它,它看起来真的不像是防火墙问题。netstat输出(在我文章的顶部)向我指出ActiveMQ没有在localhost之外侦听。我尝试从ActiveMQ服务器远程登录到它自己的IP地址,防火墙被禁用,但我仍然得到“连接被拒绝”<代码>jeremy@server:~$sudo ufw disable防火墙在系统启动时停止并禁用jeremy@server:~$telnet xxx.xxx.xxx.xxx 61616正在尝试xxx.xxx.xxx.xxx。。。telnet:无法连接到远程主机:连接被拒绝jeremy@server:~$sudo ufw enable只是一个额外的想法-是否有人可以共享一个接受外部流量的工作示例broker.xml?以防万一,我的系统在其他方面有明显的问题。默认的
conf/activemq.xml
接受外部通信。