尝试创建一个非安全的WSO2代理服务,以便向ActiveMQ JMS队列发送消息。代理服务配置xml文件如下所示,
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="StockQuoteProxy" startOnLoad="true" trace="disable"
transports="http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<send>
<endpoint>
<address trace="disable" uri="jms:/JMSQueueConsumer?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://127.0.0.1:61616&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
我也跟着WSO2文档在axis2.xml中启用了activeMQ Listener和Sender。 我还在本地主机上的activeMQ中创建了一个JMSQueueConsumer队列。 activeMQ是
up, tcp 0 0 ::ffff:127.0.0.1:61616 :::* LISTEN
然而,当我尝试向activeMQ发送消息时,我收到了错误
[PassThroughMessageProcessor-47] ERROR JMSSender Unable to create a JMSMessageSender for : null
javax.jms.JMSSecurityException: User name [null] or password is invalid.
和activeMQ显示没有活动。我应该在哪里配置用户名和密码?
答案 0 :(得分:0)
在您的情况下,您需要使用属性transport.jms.UserName和transport.jms.Password为发件人设置用户名和密码,如下所示
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy"
transports="http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<property name="FORCE_SC_ACCEPTED"
value="true"
scope="axis2"
type="STRING"/>
<send>
<endpoint>
<address uri="jms:/JMSQueueConsumer?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://127.0.0.1:61616&transport.jms.DestinationType=queue&transport.jms.UserName=admin&transport.jms.Password=secret"
trace="disable"/>
</endpoint>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<description/>
</proxy>