RANGER-2687: NoClassDefFoundError when Ranger Knox plugin is enabled
diff --git a/agents-common/src/main/java/org/apache/ranger/authorization/utils/StringUtil.java b/agents-common/src/main/java/org/apache/ranger/authorization/utils/StringUtil.java
index 17a0651..4e959bc 100644
--- a/agents-common/src/main/java/org/apache/ranger/authorization/utils/StringUtil.java
+++ b/agents-common/src/main/java/org/apache/ranger/authorization/utils/StringUtil.java
@@ -19,6 +19,7 @@
 
  package org.apache.ranger.authorization.utils;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
@@ -306,4 +307,19 @@
 		return values;
 	}
 
+	public static List<String> getURLs(String configURLs) {
+		List<String> configuredURLs = new ArrayList<>();
+		if(configURLs!=null) {
+			String[] urls = configURLs.split(",");
+			for (String strUrl : urls) {
+				if (StringUtils.isNotEmpty(StringUtils.trimToEmpty(strUrl))) {
+					if (strUrl.endsWith("/")) {
+						strUrl = strUrl.substring(0, strUrl.length() - 1);
+					}
+					configuredURLs.add(strUrl);
+				}
+			}
+		}
+		return configuredURLs;
+	}
 }
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
index 0f44a5d..1c02d3d 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
@@ -31,7 +31,6 @@
 import java.security.SecureRandom;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -52,6 +51,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.ranger.authorization.hadoop.utils.RangerCredentialProvider;
+import org.apache.ranger.authorization.utils.StringUtil;
 import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
 
 import com.google.gson.Gson;
@@ -115,7 +115,7 @@
 	public RangerRESTClient(String url, String sslConfigFileName, Configuration config) {
 		mUrl               = url;
 		mSslConfigFileName = sslConfigFileName;
-		configuredURLs     = getURLs(mUrl);
+		configuredURLs     = StringUtil.getURLs(mUrl);
 
 		setLastKnownActiveUrlIndex((new Random()).nextInt(getConfiguredURLs().size()));
 
@@ -555,23 +555,6 @@
 		return response;
 	}
 
-
-	public static List<String> getURLs(String configURLs) {
-		List<String> configuredURLs = new ArrayList<>();
-		if(configURLs!=null) {
-			String[] urls = configURLs.split(",");
-			for (String strUrl : urls) {
-				if (StringUtils.isNotEmpty(StringUtils.trimToEmpty(strUrl))) {
-					if (strUrl.endsWith("/")) {
-						strUrl = strUrl.substring(0, strUrl.length() - 1);
-					}
-					configuredURLs.add(strUrl);
-				}
-			}
-		}
-		return configuredURLs;
-	}
-
 	protected static WebResource setQueryParams(WebResource webResource, Map<String, String> params) {
 		WebResource ret = webResource;
 		if (webResource != null && params != null) {
diff --git a/knox-agent/src/main/java/org/apache/ranger/admin/client/RangerAdminJersey2RESTClient.java b/knox-agent/src/main/java/org/apache/ranger/admin/client/RangerAdminJersey2RESTClient.java
index 8ac62d3..b2184b6 100644
--- a/knox-agent/src/main/java/org/apache/ranger/admin/client/RangerAdminJersey2RESTClient.java
+++ b/knox-agent/src/main/java/org/apache/ranger/admin/client/RangerAdminJersey2RESTClient.java
@@ -107,7 +107,7 @@
 			_supportsTagDeltas = "false";
 		}
 
-		configURLs = RangerRESTClient.getURLs(tmpUrl);
+		configURLs = StringUtil.getURLs(tmpUrl);
 		this.lastKnownActiveUrlIndex = new Random().nextInt(configURLs.size());
 		_baseUrl = configURLs.get(this.lastKnownActiveUrlIndex);
 		_isSSL = _utils.isSsl(_baseUrl);