我正在尝试在WSO2 ESB 5.0.0中使用ActiveMQ配置JMS传输。我已按照https://docs.wso2.com/display/ESB500/Configure+with+ActiveMQ中的说明操作,但没有成功。
我的ActiveMQ版本是5.10。
当我通过JMS Endpoit发送消息时,我收到此错误:
TID: [-1234] [] [2016-10-11 17:42:15,618] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Unexpected error during sending message out {org.apache.synapse.core.axis2.Axis2Sender}
java.lang.ClassCastException: org.apache.activemq.ActiveMQConnectionFactory cannot be cast to javax.jms.XAConnectionFactory
at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JMSOutTransportInfo.java:377)
at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:135)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:581)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:78)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:512)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:382)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
at org.apache.synapse.endpoints.TemplateEndpoint.sendMessage(TemplateEndpoint.java:74)
at org.apache.synapse.endpoints.TemplateEndpoint.send(TemplateEndpoint.java:66)
at org.apache.synapse.endpoints.ResolvingEndpoint.sendMessage(ResolvingEndpoint.java:74)
at org.apache.synapse.endpoints.ResolvingEndpoint.send(ResolvingEndpoint.java:58)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:121)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:330)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:261)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
我们使用XA Transaction时会抛出此异常。否则它可以正常工作。
任何帮助?
答案 0 :(得分:2)
如果使用ActiveMQ 5.10,则需要将/ lib目录放入 / repository / components / lib目录下列文件:
activemq-broker-5.10.0.jar
activemq-client-5.10.0.jar
geronimo-j2ee-management_1.1_spec-1.0.1.jar
geronimo-jms_1.1_spec-1.1.1.jar
hawtbuf-1.10.jar
不是https://docs.wso2.com/display/ESB500/Configure+with+ActiveMQ
中列出的文件答案 1 :(得分:2)
ActiveMQ有一个XA连接工厂:
指定:org.apache.activemq.ActiveMQXAConnectionFactory
答案 2 :(得分:2)
在使用Active MQ版本5.10时,必须将以下来自版本5.8的jar添加到$ ESB_HOME / repository / components / lib中。
在/repository/conf/axis2/axis2.xml中取消注释JMS传输侦听器和JMS传输接收器。
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="myTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
<parameter name="myQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>
然后启动服务器。
您必须根据您的方案检查配置[1]。
当ESB发送到jms端点时,示例代码如下:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="http">
<target>
<inSequence>
<property action="set" name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory& java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
您的错误指示有关JMS发件人的问题。特别检查axis2中的配置以及定义jms端点的代理配置。