gpt4 book ai didi

activemq-artemis - ActiveMQ Artemis 传输方案无法识别 [vm] 错误

转载 作者:行者123 更新时间:2023-12-03 08:51:51 25 4
gpt4 key购买 nike

我尝试运行此代码:

EmbeddedActiveMQ server = new EmbeddedActiveMQ();
server.setConfiguration(new ConfigurationImpl()
.setAcceptorConfigurations(singleton(new TransportConfiguration(
InVMAcceptorFactory.class.getName())))
.setPersistenceEnabled(false)
.setSecurityEnabled(false));
server.start();

ConnectionFactory cf = new ActiveMQConnectionFactory("vm://0");
Connection connection = cf.createConnection();

但是我遇到了这个异常:

javax.jms.JMSException: Could not create Transport. Reason: java.io.IOException: Transport scheme NOT recognized: [vm]
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)
at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:333)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:346)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:304)
at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:244)
at com.hazelcast.jet.examples.jms.JmsTopicSample.main(JmsTopicSample.java:84)
Caused by: java.io.IOException: Transport scheme NOT recognized: [vm]
at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:28)
at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:185)
at org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:64)
at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:331)
... 4 more
Caused by: java.io.IOException: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/vm
at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.loadProperties(FactoryFinder.java:98)
at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.create(FactoryFinder.java:60)
at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:148)
at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:182)
... 6 more

我在网上找到的所有内容都表明我缺少对类路径的某些依赖项,但 vm 协议(protocol)没有失败。

最佳答案

原来我使用了错误的导入。我用过:

org.apache.activemq.ActiveMQConnectionFactory

但我应该使用:

org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory

出于某种原因,apache-artemis:2.10.1 包含对 activemq 版本 5 中的 activemq-client 的依赖,其中包括另一个类。

关于activemq-artemis - ActiveMQ Artemis 传输方案无法识别 [vm] 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58434684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com