You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by 郭杰 <wa...@gmail.com> on 2013/04/01 08:26:55 UTC

About LocalResource

Hi,

  I wrote a yarn application with two LocalResource, AppMaster.jar and
log4j.properties in hadoop-2.0.3-alpha.

 After several tries, I found I must set both $PWD and ./* in my CLASSPATH
 environment  params to load mainclass and log4j.properties. Since yarn
has created symlinks about two LocalResource, in my mind only './*' will be
ok.  Why did this happen?

btw, I picked a part of launch_container script to figure out why here.

export
PWD="/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/
ln -sf
"/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-1997165377357121547/log4j.properties"
"log4j.properties"
ln -sf
"/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-4433130098352976813/AppMaster.jar"
"AppMaster.jar"

Re: About LocalResource

Posted by Robert Evans <ev...@yahoo-inc.com>.
A jar and a the directory a jar is in are not the same things from the class paths perspective.  ./* only picks up .jar files in the current directory. $PWD is the same as ./ and does not pick up any jars in the current directory, instead it looks for .class files and other resources that are relative to the current working directory. This is pure java and has nothing to do with Hadoop specifically.

--Bobby

From: 郭杰 <wa...@gmail.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Date: Monday, April 1, 2013 1:26 AM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Subject: About LocalResource

Hi,

  I wrote a yarn application with two LocalResource, AppMaster.jar and log4j.properties in hadoop-2.0.3-alpha.

 After several tries, I found I must set both $PWD and ./* in my CLASSPATH  environment  params to load mainclass and log4j.properties. Since yarn has created symlinks about two LocalResource, in my mind only './*' will be ok.  Why did this happen?

btw, I picked a part of launch_container script to figure out why here.

export PWD="/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-1997165377357121547/log4j.properties" "log4j.properties"
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-4433130098352976813/AppMaster.jar" "AppMaster.jar"

Re: About LocalResource

Posted by Robert Evans <ev...@yahoo-inc.com>.
A jar and a the directory a jar is in are not the same things from the class paths perspective.  ./* only picks up .jar files in the current directory. $PWD is the same as ./ and does not pick up any jars in the current directory, instead it looks for .class files and other resources that are relative to the current working directory. This is pure java and has nothing to do with Hadoop specifically.

--Bobby

From: 郭杰 <wa...@gmail.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Date: Monday, April 1, 2013 1:26 AM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Subject: About LocalResource

Hi,

  I wrote a yarn application with two LocalResource, AppMaster.jar and log4j.properties in hadoop-2.0.3-alpha.

 After several tries, I found I must set both $PWD and ./* in my CLASSPATH  environment  params to load mainclass and log4j.properties. Since yarn has created symlinks about two LocalResource, in my mind only './*' will be ok.  Why did this happen?

btw, I picked a part of launch_container script to figure out why here.

export PWD="/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-1997165377357121547/log4j.properties" "log4j.properties"
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-4433130098352976813/AppMaster.jar" "AppMaster.jar"

Re: About LocalResource

Posted by Robert Evans <ev...@yahoo-inc.com>.
A jar and a the directory a jar is in are not the same things from the class paths perspective.  ./* only picks up .jar files in the current directory. $PWD is the same as ./ and does not pick up any jars in the current directory, instead it looks for .class files and other resources that are relative to the current working directory. This is pure java and has nothing to do with Hadoop specifically.

--Bobby

From: 郭杰 <wa...@gmail.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Date: Monday, April 1, 2013 1:26 AM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Subject: About LocalResource

Hi,

  I wrote a yarn application with two LocalResource, AppMaster.jar and log4j.properties in hadoop-2.0.3-alpha.

 After several tries, I found I must set both $PWD and ./* in my CLASSPATH  environment  params to load mainclass and log4j.properties. Since yarn has created symlinks about two LocalResource, in my mind only './*' will be ok.  Why did this happen?

btw, I picked a part of launch_container script to figure out why here.

export PWD="/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-1997165377357121547/log4j.properties" "log4j.properties"
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-4433130098352976813/AppMaster.jar" "AppMaster.jar"

Re: About LocalResource

Posted by Robert Evans <ev...@yahoo-inc.com>.
A jar and a the directory a jar is in are not the same things from the class paths perspective.  ./* only picks up .jar files in the current directory. $PWD is the same as ./ and does not pick up any jars in the current directory, instead it looks for .class files and other resources that are relative to the current working directory. This is pure java and has nothing to do with Hadoop specifically.

--Bobby

From: 郭杰 <wa...@gmail.com>>
Reply-To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Date: Monday, April 1, 2013 1:26 AM
To: "user@hadoop.apache.org<ma...@hadoop.apache.org>" <us...@hadoop.apache.org>>
Subject: About LocalResource

Hi,

  I wrote a yarn application with two LocalResource, AppMaster.jar and log4j.properties in hadoop-2.0.3-alpha.

 After several tries, I found I must set both $PWD and ./* in my CLASSPATH  environment  params to load mainclass and log4j.properties. Since yarn has created symlinks about two LocalResource, in my mind only './*' will be ok.  Why did this happen?

btw, I picked a part of launch_container script to figure out why here.

export PWD="/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-1997165377357121547/log4j.properties" "log4j.properties"
ln -sf "/var/data/hadoop/hadoop-2.0.3-alpha/nm/usercache/guojie/appcache/application_1364315005746_0011/filecache/-4433130098352976813/AppMaster.jar" "AppMaster.jar"