无法将消息发送到activemq中的xmpp队列

时间:2013-02-14 10:22:41

标签: java jms xmpp activemq

我无法向activemq中的xmpp队列发送消息。我得到以下示例。根据我下载 wstx jar并放在activemq/lib/optional文件夹中的文档。

我得到以下异常:

Caught: javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [xmpp]
javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [xmpp]
        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35)
        at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:252)
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:265)
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:238)
        at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:184)
        at App$HelloWorldProducer.run(App.java:41)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Transport scheme NOT recognized: [xmpp]
        at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
        at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:196)
        at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:66)
        at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:250)
        ... 5 more
Caused by: java.io.IOException: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/xmpp
        at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.loadProperties(FactoryFinder.java:96)
        at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.create(FactoryFinder.java:58)
        at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:146)
        at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:193)
        ... 7 more

感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

您需要将activemq-xmpp依赖项添加到maven pom.xml

  <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-xmpp</artifactId>
<version>5.8.0</version>
 </dependency>            

如果你没有使用maven,那么将activemq-xmpp.jar添加到/ lib与所有其他jar