From c7e0a921819cd39896e11bbfa008432633a88581 Mon Sep 17 00:00:00 2001 From: Justin Bertram Date: Thu, 23 Feb 2017 14:41:07 -0600 Subject: [PATCH] ARTEMIS-992 deal w/bad connector-ref in cluster-cxn --- .../artemis/core/deployers/impl/FileConfigurationParser.java | 5 +++++ .../activemq/artemis/core/server/ActiveMQServerLogger.java | 4 ++++ .../artemis/core/server/cluster/ClusterController.java | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java index 94e78af68c..cea05988d2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java @@ -1404,6 +1404,11 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { String connectorName = getString(e, "connector-ref", null, Validators.NOT_NULL_OR_EMPTY); + if (!mainConfig.getConnectorConfigurations().containsKey(connectorName)) { + ActiveMQServerLogger.LOGGER.connectorRefNotFound(connectorName, name); + return; + } + boolean duplicateDetection = getBoolean(e, "use-duplicate-detection", ActiveMQDefaultConfiguration.isDefaultClusterDuplicateDetection()); MessageLoadBalancingType messageLoadBalancingType; 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 d8c9192bd4..6ee844b07b 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 @@ -1287,6 +1287,10 @@ public interface ActiveMQServerLogger extends BasicLogger { @Message(id = 222216, value = "Security problem while creating session: {0}", format = Message.Format.MESSAGE_FORMAT) void securityProblemWhileCreatingSession(String message); + @LogMessage(level = Logger.Level.WARN) + @Message(id = 222217, value = "Cannot find connector-ref {0}. The cluster-connection {1} will not be deployed.", format = Message.Format.MESSAGE_FORMAT) + void connectorRefNotFound(String connectorRef, String clusterConnection); + @LogMessage(level = Logger.Level.ERROR) @Message(id = 224000, value = "Failure in initialisation", format = Message.Format.MESSAGE_FORMAT) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java index 15595f83a6..b47dca985a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterController.java @@ -317,6 +317,10 @@ public class ClusterController implements ActiveMQComponent { @Override public void handlePacket(Packet packet) { + if (!isStarted()) { + return; + } + if (!authorized) { if (packet.getType() == PacketImpl.CLUSTER_CONNECT) { ClusterConnection clusterConnection = acceptorUsed.getClusterConnection();