[AMQ-7301] Remove guava dependency to implement own getRootCause() method
diff --git a/activemq-broker/pom.xml b/activemq-broker/pom.xml
index 081a035..7945cfb 100644
--- a/activemq-broker/pom.xml
+++ b/activemq-broker/pom.xml
@@ -87,11 +87,6 @@
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-databind</artifactId>
     </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <version>${guava-version}</version>
-    </dependency>
   </dependencies>
 
   <reporting>
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
index 280ded6..ddc020b 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
@@ -19,14 +19,15 @@
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.ArrayList;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.StringTokenizer;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.regex.Pattern;
 
 import javax.management.ObjectName;
 
-import com.google.common.base.Throwables;
 import org.apache.activemq.broker.jmx.ManagedTransportConnector;
 import org.apache.activemq.broker.jmx.ManagementContext;
 import org.apache.activemq.broker.region.ConnectorStatistics;
@@ -240,9 +241,9 @@
 
             private void onAcceptError(Exception error, String remoteHost) {
                 if (brokerService != null && brokerService.isStopping()) {
-                    LOG.info("Could not accept connection during shutdown {} : {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getLocalizedMessage(), Throwables.getRootCause(error).getMessage());
+                    LOG.info("Could not accept connection during shutdown {} : {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getLocalizedMessage(), getRootCause(error).getMessage());
                 } else {
-                    LOG.warn("Could not accept connection from {}: {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getMessage(), Throwables.getRootCause(error).getMessage());
+                    LOG.warn("Could not accept connection from {}: {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getMessage(), getRootCause(error).getMessage());
                     LOG.debug("Reason: " + error.getMessage(), error);
                 }
             }
@@ -263,6 +264,20 @@
         LOG.info("Connector {} started", getName());
     }
 
+    static Throwable getRootCause(final Throwable throwable) {
+        final List<Throwable> list = getThrowableList(throwable);
+        return list.isEmpty() ? null : list.get(list.size() - 1);
+    }
+
+    static List<Throwable> getThrowableList(Throwable throwable) {
+        final List<Throwable> list = new ArrayList<>();
+        while (throwable != null && !list.contains(throwable)) {
+            list.add(throwable);
+            throwable = throwable.getCause();
+        }
+        return list;
+    }
+
     public String getPublishableConnectString() throws Exception {
         String publishableConnectString = publishedAddressPolicy.getPublishableConnectString(this);
         LOG.debug("Publishing: {} for broker transport URI: {}", publishableConnectString, getConnectUri());
diff --git a/activemq-osgi/pom.xml b/activemq-osgi/pom.xml
index 10fd8d8..2f655c9 100644
--- a/activemq-osgi/pom.xml
+++ b/activemq-osgi/pom.xml
@@ -102,8 +102,7 @@
          com.google.errorprone.annotations.concurrent,
          com.google.j2objc.annotations,
          org.linkedin*,
-         org.iq80*,
-         com.google.common.base
+         org.iq80*
     </activemq.osgi.private.pkg>
     <activemq.osgi.dynamic.import>*</activemq.osgi.dynamic.import>
     <surefire.argLine>-Xmx512M</surefire.argLine>