Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveMQ Broker Factory Could not find factory class for failover

I am getting this error when trying to create a ActiveMQ broker with the BrokerFactory:

java.io.IOException: Could not load failover factory:java.io.IOException: Could not find factory class for resource: META-INF/services/org/apache/activemq/broker/failover
    at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
    at org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
    at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:70)
    at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
    at ...
Caused by: java.io.IOException: Could not find factory class for resource: META-INF/services/org/apache/activemq/broker/failover
    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.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
    ... 5 more

It seems like pathing error or something similar, I just cant figure out the root cause.

This is the code causing it:

URI brokerUri = new URI(bean.getBrokerConfigUrl());
broker = BrokerFactory.createBroker(brokerUri);

Here is the url I am calling:

failover:(tcp://internalUrl.net:port#,tcp://internalUrl.net:port#)?randomize=false&timeout=30000&jms.redeliveryPolicy.maximumRedeliveries=-1&jms.prefetchPolicy.all=0

So is this likely a pathing error? Am I not including a required jar? Is the url not formatted properly? I'm lost here.

Edit: Added bounty

like image 245
Tim Avatar asked Aug 06 '15 16:08

Tim


People also ask

How does ActiveMQ failover work?

The Failover transport randomly chooses one of the composite URIs and attempts to establish a connection to it. If it does not succeed, or if it subsequently fails, a new connection is established choosing one of the other URIs randomly from the list.

What is Artemis MQ?

Apache ActiveMQ Artemis is an asynchronous messaging system, an example of Message Oriented Middleware , we'll just call them messaging systems in the remainder of this book.

What is ActiveMQ broker?

Apache ActiveMQ® is the most popular open source, multi-protocol, Java-based message broker. It supports industry standard protocols so users get the benefits of client choices across a broad range of languages and platforms. Connect from clients written in JavaScript, C, C++, Python, . Net, and more.

What is broker service in Java?

A BrokerService consists of a number of transport connectors, network connectors and a bunch of properties which can be used to configure the broker as its lazily created.


1 Answers

This isn't a classpath or jar issue. According to the active MQ documentation the BrokerFactory only supports URIs for xbean, broker or properties and does not support a failover URI.

The following two documents should give you more information on setting up and configuring a broker factory.

http://activemq.apache.org/broker-configuration-uri.html

http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html

like image 86
Aestel Avatar answered Sep 22 '22 03:09

Aestel