title: Spark Submit in Cluster mode failing when main method is doing nothing
body: <p>I have implemented some logic in spark. Execution of this logic depends on the parameter passed to the Java code. In my main method, I have a switch case. When I pass a correct parameter, everything works fine. When I pass some random parameter which is not in my switch case I am getting Spark Exception. Finished with failed status. </p>
  
  <p>If I run the same code in Client mode, it is not throwing any exception with incorrect parameter which I guess is the correct behavior.</p>
  
  <p>I am creating context only when my parameter is correct. So basically if I give an empty main method in Cluster mode, I am getting exception. </p>
  
  <p>Can someone explains me how this works. How can I avoid this exception.</p>
  
  <pre><code>public class MyClass{
  private JavaSparkContext context = null;
  private HiveContext hiveContext = null;
  public static void main(String[] args) {
  
  
      MyClass obj = new MyClass();
      obj.startProcessing(args);      
  }
  </code></pre>
  
  <p>startProcessing method simple contains a switch case.</p>
  
  <p>Thanks </p>
  
  <p>Stacktrace:</p>
  
  <pre><code>  Exception in thread "main" org.apache.spark.SparkException: Application application_1466638963111_3824 finished with failed status
      at org.apache.spark.deploy.yarn.Client.run(Client.scala:1036)
      at org.apache.spark.deploy.yarn.Client$.main(Client.scala:1083)
      at org.apache.spark.deploy.yarn.Client.main(Client.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
      at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
      at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  </code></pre>