I have a problem with running spark application on standalone cluster. (I use spark 1.1.0 version). I succesfully run master server by command:
bash start-master
Found a way to run it using IDE / Maven
org.apache.maven.plugins maven-shade-plugin 2.2 *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA job-driver-jar package shade true driver reference.conf mainClass worker-library-jar package shade true worker
SparkConf conf = new SparkConf().setAppName("appName").setMaster("spark://machineName:7077").setJars(new String[] {"target/appName-1.0-SNAPSHOT-driver.jar"});
Run mvn clean package to create the Jar file. It will be created in your target folder.
Run using your IDE or using maven command :
mvn exec:java -Dexec.mainClass="className"
This does not require spark-submit. Just remember to package file before running
If you don't want to hardcode the jar path, you can do this :
SparkConf conf = new SparkConf() .setAppName("appName") .setMaster("spark://machineName:7077") .setJars(JavaSparkContext.jarOfClass(this.getClass()));
java -jar target/application-1.0-SNAPSHOT-driver.jar
This will take the jar from the jar the class was loaded.