Zoltan Haindrich created YARN-8252:
--------------------------------------

             Summary: Fix ServiceMaster main not found
                 Key: YARN-8252
                 URL: https://issues.apache.org/jira/browse/YARN-8252
             Project: Hadoop YARN
          Issue Type: Bug
    Affects Versions: 3.1.0
            Reporter: Zoltan Haindrich


I was looking into using yarn services; however it seems for some reason it is 
not possible to run {{ServiceMaster}} class from the jar...I might be missing 
some fundamental...so I've put together a shellscript to make it easy for 
anyone to check....I would be happy with any exception beyond main not found....

[ServiceMaster.main 
method|https://github.com/apache/hadoop/blob/67f239c42f676237290d18ddbbc9aec369267692/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java#L305]
{code:java}
#!/bin/bash
set -e

wget -O core.jar  -nv 
http://central.maven.org/maven2/org/apache/hadoop/hadoop-yarn-services-core/3.1.0/hadoop-yarn-services-core-3.1.0.jar

unzip -qn core.jar
cat > org/apache/hadoop/yarn/service/ServiceMaster2.java << EOF
package org.apache.hadoop.yarn.service;
public class ServiceMaster2 {
  public static void main(String[] args) throws Exception {
    System.out.println("asd!");
  }
}
EOF

javac org/apache/hadoop/yarn/service/ServiceMaster2.java

jar -cf a1.jar org

find org -name ServiceMaster*
# this will print "asd!"
java -cp a1.jar org.apache.hadoop.yarn.service.ServiceMaster2
#the following invocations result in:
# Error: Could not find or load main class 
org.apache.hadoop.yarn.service.ServiceMaster
#
set +e
java -cp a1.jar org.apache.hadoop.yarn.service.ServiceMaster
java -cp core.jar org.apache.hadoop.yarn.service.ServiceMaster
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-dev-h...@hadoop.apache.org

Reply via email to