我正在尝试在activemq中设置代理网络,我目前的设置是有两个代理,每个代理在不同的vm上运行。我的配置是:
<networkConnectors>
<networkConnector
name="Q:broker1->broker2"
uri="static:(tcp://10.10.10.12:61612)"
duplex="false"
decreaseNetworkConsumerPriority="true"
networkTTL="2"
dynamicOnly="true"
userName="activemq"
password="password">
<excludedDestinations>
<topic physicalName=">" />
</excludedDestinations>
</networkConnector>
</networkConnectors>
当我在broker1上启动activemq时出现此错误:
2016-11-01 17:49:18,571 | INFO | Establishing network connection from vm://localhost?create=false&async=false to tcp://10.10.10.12:61612 | org.apache.activemq.network.DiscoveryNetworkConnector | ActiveMQ Task-1
2016-11-01 17:49:18,572 | INFO | Connector vm://localhost started | org.apache.activemq.broker.TransportConnector | ActiveMQ Task-1
2016-11-01 17:49:18,578 | WARN | Failed to add Connection localhost->localhost-34161-1478036807089-20:1 due to java.lang.SecurityException: User name [activemq] or password is invalid. | org.apache.activemq.broker.TransportConnection | triggerStartAsyncNetworkBridgeCreation: remoteBroker=tcp:///10.10.10.12:61612@43981, localBroker= vm://localhost#18
2016-11-01 17:49:18,580 | WARN | Security Error occurred on connection to: vm://localhost#18, User name [activemq] or password is invalid. | org.apache.activemq.broker.TransportConnection.Service | triggerStartAsyncNetworkBridgeCreation: remoteBroker=tcp:///10.10.10.12:61612@43981, localBroker= vm://localhost#18
2016-11-01 17:49:18,580 | INFO | Network connection between vm://localhost#18 and tcp:///10.10.10.12:61612@43981 shutdown due to a local error: java.lang.SecurityException: User name [activemq] or password is invalid. | org.apache.activemq.network.DemandForwardingBridgeSupport | triggerStartAsyncNetworkBridgeCreation: remoteBroker=tcp:///10.10.10.12:61612@43981, localBroker= vm://localhost#18
2016-11-01 17:49:18,583 | INFO | Connector vm://localhost stopped | org.apache.activemq.broker.TransportConnector | ActiveMQ BrokerService[localhost] Task-8
2016-11-01 17:49:18,584 | INFO | localhost bridge to localhost stopped | org.apache.activemq.network.DemandForwardingBridgeSupport | ActiveMQ BrokerService[localhost] Task-8
2016-11-01 17:49:20,580 | INFO | Stopping vm://localhost#18 because Failed with SecurityException: User name [activemq] or password is invalid. | org.apache.activemq.broker.TransportConnection | ActiveMQ BrokerService[localhost] Task-5
我在broker2 activemq.xml中设置了activemq用户,如下所示:
<simpleAuthenticationPlugin>
<users>
<authenticationUser username="activemq" password="${activemq.password}"
groups="admins"/>
并且用户activemq在credentials-enc.properties文件中定义,如:
activemq.password=password
为什么broker1能够与broker2建立连接?我在这里失踪了什么?
答案 0 :(得分:0)
添加userName和password属性,如下所示:
<networkConnector .. userName="admin" password="admin".. >