ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [01/46] ignite git commit: IGNITE-3928: Hadoop: Print warning if Hadoop is in classpath.
Date Mon, 26 Sep 2016 07:16:57 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1.6.8-hadoop 0e4379551 -> 4c1739ced


IGNITE-3928: Hadoop: Print warning if Hadoop is in classpath.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/de739ee5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/de739ee5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/de739ee5

Branch: refs/heads/ignite-1.6.8-hadoop
Commit: de739ee5c8236e3ac4584a70868c670b788b8538
Parents: 0e43795
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Sep 23 18:27:26 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Sep 23 18:27:26 2016 +0300

----------------------------------------------------------------------
 .../processors/hadoop/HadoopProcessor.java      | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/de739ee5/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
index 520f094..f0df1e9 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopProcessor.java
@@ -40,6 +40,9 @@ import java.util.concurrent.atomic.AtomicInteger;
  * Hadoop processor.
  */
 public class HadoopProcessor extends HadoopProcessorAdapter {
+    /** Class to probe for Hadoop libraries in Ignite classpath. */
+    private static final String HADOOP_PROBE_CLS = "org.apache.hadoop.conf.Configuration";
+
     /** Job ID counter. */
     private final AtomicInteger idCtr = new AtomicInteger();
 
@@ -210,6 +213,26 @@ public class HadoopProcessor extends HadoopProcessorAdapter {
             throw new IgniteCheckedException(ioe.getMessage(), ioe);
         }
 
+        // Check if Hadoop is in parent class loader classpath.
+        try {
+            Class cls = Class.forName(HADOOP_PROBE_CLS, false, getClass().getClassLoader());
+
+            try {
+                String path = cls.getProtectionDomain().getCodeSource().getLocation().toString();
+
+                U.warn(log, "Hadoop libraries are found in Ignite classpath, this could lead
to class loading " +
+                    "errors (please remove all Hadoop libraries from Ignite classpath) [path="
+ path + ']');
+            }
+            catch (Throwable ignore) {
+                U.warn(log, "Hadoop libraries are found in Ignite classpath, this could lead
to class loading " +
+                    "errors (please remove all Hadoop libraries from Ignite classpath)");
+            }
+        }
+        catch (Throwable ignore) {
+            // All is fine.
+        }
+
+        // Try assembling Hadoop URLs.
         HadoopClassLoader.hadoopUrls();
     }
 


Mime
View raw message