I have hadoop 1.0.4 installed. I have modified the /usr/bin/hadoop file by adding the following:
HADOOP_DEBUG="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5000"
elif [ "$COMMAND" = "jar" ] ; then
CLASS=org.apache.hadoop.util.RunJar
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
elif [ "$COMMAND" = "jar-debug" ] ; then
CLASS=org.apache.hadoop.util.RunJar
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS $HADOOP_DEBUG"
COMMAND="jar"
This way I can run "hadoop jar SomeJar.jar SomeClass" to launch normally or run "hadoop jar-debug SomeJar.jar SomeClass" to launch in debug mode. This works, except when I want to pass command line arguments into my class (such as in the WordCount example). For example running:
"hadoop jar-debug WordCount.jar WordCount InputDir OutputDir"
with a breakpoint on the first line in the main class reveals that String[] args is an empty string (which obviously causes the program to fail later). If I run it using the normal jar command it works fine (so obviously the command line args are get passed in just fine using regular jar).
Anyone have any idea whats going on here? I am seriously stuck. Thanks in advance.
Update for anyone in the future who experiences this problem:
If the java remote debugger is launched listening to the wrong IP Address (IE listening to a remote namenode instead of localhost), the JRD will still launch but command line parameters are not passed in.