Skip to content

Commit

Permalink
fixes SPARK-4298
Browse files Browse the repository at this point in the history
  • Loading branch information
Brennon York committed Nov 27, 2014
1 parent 5af53ad commit 8da7cbf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.spark.deploy

import java.net.URI
import java.util.jar.JarFile

import scala.collection.mutable.{ArrayBuffer, HashMap}
Expand Down Expand Up @@ -124,12 +125,13 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St
// Try to set main class from JAR if no --class argument is given
if (mainClass == null && !isPython && primaryResource != null) {
try {
val jar = new JarFile(primaryResource)
val jar = new JarFile(new URI(primaryResource).getPath)
// Note that this might still return null if no main-class is set; we catch that later
mainClass = jar.getManifest.getMainAttributes.getValue("Main-Class")
} catch {
case e: Exception =>
SparkSubmit.printErrorAndExit("Cannot load main class from JAR: " + primaryResource)
SparkSubmit.printErrorAndExit("Cannot main: " + primaryResource)
//SparkSubmit.printErrorAndExit("Cannot load main class from JAR: " + primaryResource)
return
}
}
Expand Down

0 comments on commit 8da7cbf

Please sign in to comment.