Reputation: 10822
I tried to run this code:
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();
But I got this exception:
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
All I could find on the web suggested that I'm missing some dependency on the classpath, but none failed with the vm
protocol.
Upvotes: 5
Views: 9770
Reputation: 328860
If you run into this error and you're not using Apache Artemis, then make sure activemq-broker
is on the classpath.
Upvotes: 3
Reputation: 10822
It turned out that I used a wrong import. I used:
org.apache.activemq.ActiveMQConnectionFactory
but I should have used:
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory
For some reason the apache-artemis:2.10.1
includes dependency to activemq-client
from activemq version 5, which includes the other class.
Upvotes: 4