[ 
https://issues.apache.org/jira/browse/HADOOP-9450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13621553#comment-13621553
 ] 

Chris Nauroth commented on HADOOP-9450:
---------------------------------------

Hi, Mitch.  HADOOP_USER_CLASSPATH_FIRST has been working fine for me.  What 
version of the code are you running?  I checked the trunk and branch-1 versions 
of this code, and both seem to be correct.  There are 3 snippets that are 
relevant.  First, CLASSPATH is initialized to HADOOP_CONF_DIR:

{code}
# CLASSPATH initially contains $HADOOP_CONF_DIR
CLASSPATH="${HADOOP_CONF_DIR}"
{code}

Second, there is a check if HADOOP_USER_CLASSPATH_FIRST and HADOOP_CLASSPATH 
are defined.  If defined, then the next thing becomes HADOOP_CLASSPATH.  Note 
that HADOOP_CONF_DIR would still be first, but this should be fine, because 
jars/classes don't really go in the conf dir.

{code}
if [ "$HADOOP_USER_CLASSPATH_FIRST" != "" ] && [ "$HADOOP_CLASSPATH" != "" ] ; 
then
  CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
fi
{code}

After this, there is logic for adding the various Hadoop classpath entries from 
the build.  Finally, there is a second check of HADOOP_USER_CLASSPATH_FIRST and 
HADOOP_CLASSPATH:

{code}
# add user-specified CLASSPATH last
if [ "$HADOOP_USER_CLASSPATH_FIRST" = "" ] && [ "$HADOOP_CLASSPATH" != "" ]; 
then
  CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
fi
{code}

This is the opposite of the first check: if HADOOP_USER_CLASSPATH_FIRST and 
HADOOP_CLASSPATH are undefined, then now we need to add them as the last 
entries.

I think this all works correctly, but were you looking at a different version 
of the code?
                
> HADOOP_USER_CLASSPATH_FIRST is not honored; CLASSPATH is PREpended instead of 
> APpended
> --------------------------------------------------------------------------------------
>
>                 Key: HADOOP-9450
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9450
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Mitch Wyle
>
> On line 133 of the hadoop shell wrapper, CLASSPATH is set as:
> CLASSPATH=${CLASSPATH}:${HADOOP_CLASSPATH}
> Notice that the built-up CLASSPATH, along with all the libs and unwanted JARS 
> are pre-pended BEFORE the user's HADOOP_CLASSPATH.  Therefore there is no way 
> to put your own JARs in front of those that the hadoop wrapper script sets.
> We propose a patch that reverses this order.  Failing that, we would like to 
> add a command line option to override this behavior and enable a user's JARs 
> to be found before the wrong ones in the Hadoop library paths.
> We always welcome your opinions.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to