diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java index b359592647..8267144e7e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServerLogger.java @@ -1773,6 +1773,11 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 222307, value = "The queues element is deprecated and replaced by the addresses element") void queuesElementDeprecated(); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222308, value = "Unable to listen for incoming fail-back request because {0} is null. Ensure the broker has the proper cluster-connection configuration.", + format = Message.Format.MESSAGE_FORMAT) + void failBackCheckerFailure(String component); + @LogMessage(level = Logger.Level.ERROR) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java index 0b21445102..023a7387fc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/SharedStoreBackupActivation.java @@ -35,6 +35,8 @@ import org.apache.activemq.artemis.core.server.NodeManager; import org.apache.activemq.artemis.core.server.NodeManager.LockListener; import org.apache.activemq.artemis.core.server.NodeManager.NodeManagerException; import org.apache.activemq.artemis.core.server.QueueFactory; +import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; +import org.apache.activemq.artemis.core.server.cluster.ClusterManager; import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy; import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy; import org.apache.activemq.artemis.core.server.group.GroupingHandler; @@ -253,15 +255,29 @@ public final class SharedStoreBackupActivation extends Activation { BackupTopologyListener backupListener; FailbackChecker() { - TransportConfiguration connector = activeMQServer.getClusterManager().getDefaultConnection(null).getConnector(); - backupListener = new BackupTopologyListener(activeMQServer.getNodeID().toString(), connector); - activeMQServer.getClusterManager().getDefaultConnection(null).addClusterTopologyListener(backupListener); + ClusterManager clusterManager = activeMQServer.getClusterManager(); + if (clusterManager != null) { + ClusterConnection clusterConnection = clusterManager.getDefaultConnection(null); + if (clusterConnection != null) { + TransportConfiguration connector = clusterConnection.getConnector(); + if (connector != null) { + backupListener = new BackupTopologyListener(activeMQServer.getNodeID().toString(), connector); + clusterConnection.addClusterTopologyListener(backupListener); + } else { + ActiveMQServerLogger.LOGGER.failBackCheckerFailure("connector"); + } + } else { + ActiveMQServerLogger.LOGGER.failBackCheckerFailure("cluster connection"); + } + } else { + ActiveMQServerLogger.LOGGER.failBackCheckerFailure("cluster manager"); + } } @Override public void run() { try { - if (!restarting.get() && activeMQServer.getNodeManager().isAwaitingFailback() && backupListener.waitForBackup()) { + if (!restarting.get() && activeMQServer.getNodeManager().isAwaitingFailback() && backupListener != null && backupListener.waitForBackup()) { if (!restarting.compareAndSet(false, true)) { return; }