From 009af54d5192c822ba1299c1389e67266dfe7ad1 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 22 Apr 2013 20:07:06 +0000 Subject: [PATCH] MAPREDUCE-5146. application classloader may be used too early to load classes. Contributed by Sangjin Lee. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1470694 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/mapred/YarnChild.java | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index cf6d4153cd..7236052f6c 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -330,6 +330,9 @@ Release 2.0.5-beta - UNRELEASED MAPREDUCE-5066. Added a timeout for the job.end.notification.url. (Ivan Mitic via acmurthy) + MAPREDUCE-5146. application classloader may be used too early to load + classes. (Sangjin Lee via tomwhite) + Release 2.0.4-alpha - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java index 33ff626df3..27847889d7 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/YarnChild.java @@ -20,10 +20,8 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.io.PrintStream; import java.net.InetSocketAddress; import java.net.URI; import java.security.PrivilegedExceptionAction; @@ -148,6 +146,9 @@ public TaskUmbilicalProtocol run() throws Exception { // Add tokens to new user so that it may execute its task correctly. childUGI.addCredentials(credentials); + // set job classloader if configured before invoking the task + MRApps.setJobClassLoader(job); + // Create a final reference to the task for the doAs block final Task taskFinal = task; childUGI.doAs(new PrivilegedExceptionAction() { @@ -255,9 +256,6 @@ private static JobConf configureTask(Task task, Credentials credentials, final JobConf job = new JobConf(MRJobConfig.JOB_CONF_FILE); job.setCredentials(credentials); - // set job classloader if configured - MRApps.setJobClassLoader(job); - String appAttemptIdEnv = System .getenv(MRJobConfig.APPLICATION_ATTEMPT_ID_ENV); LOG.debug("APPLICATION_ATTEMPT_ID: " + appAttemptIdEnv);