How do I run an example from HERE Open Location Platform SDK locally?

373 Views Asked by At

I'm trying to run a batch processing example delivered with HERE Open Location Platform SDK.

My maven exec looks like this:

mvn exec:java -Dexec.cleanupDaemonThreads=false \
  -Dexec.mainClass=com.here.platform.examples.location.batch.Main \
  -Dpipeline-config.file=config/pipeline-config.conf \
  -Dpipeline-job.file=config/pipeline-job.conf

and I've received a following exception:

java.lang.RuntimeException: Cannot setup Spark and the Driver
    at com.here.platform.data.processing.driver.DriverRunner$class.runJob (DriverRunner.scala:115)
    at com.here.platform.examples.location.batch.Main$.runJob (Main.scala:24)
    at com.here.platform.data.processing.driver.CmdLineRunner$class.run (CmdLineRunner.scala:42)
    at com.here.platform.examples.location.batch.Main$.run (Main.scala:24)
    at com.here.platform.data.processing.driver.CmdLineRunner$class.main (CmdLineRunner.scala:59)
    at com.here.platform.examples.location.batch.Main$.main (Main.scala:24)
    at com.here.platform.examples.location.batch.Main.main (Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.spark.SparkException: A master URL must be set in your configuration
    at org.apache.spark.SparkContext.<init> (SparkContext.scala:379)
    at com.here.platform.data.processing.driver.DriverRunner$class.com$here$platform$data$processing$driver$DriverRunner$$newSparkContext (DriverRunner.scala:176)
    at com.here.platform.data.processing.driver.DriverRunner$$anonfun$2$$anonfun$3.apply (DriverRunner.scala:106)
    at com.here.platform.data.processing.driver.DriverRunner$$anonfun$2$$anonfun$3.apply (DriverRunner.scala:106)
    at scala.Option.getOrElse (Option.scala:121)
    at com.here.platform.data.processing.driver.DriverRunner$$anonfun$2.apply (DriverRunner.scala:106)
    at com.here.platform.data.processing.driver.DriverRunner$$anonfun$2.apply (DriverRunner.scala:105)
    at scala.util.Try$.apply (Try.scala:192)
    at com.here.platform.data.processing.driver.DriverRunner$class.runJob (DriverRunner.scala:105)
    at com.here.platform.examples.location.batch.Main$.runJob (Main.scala:24)
    at com.here.platform.data.processing.driver.CmdLineRunner$class.run (CmdLineRunner.scala:42)
    at com.here.platform.examples.location.batch.Main$.run (Main.scala:24)
    at com.here.platform.data.processing.driver.CmdLineRunner$class.main (CmdLineRunner.scala:59)
    at com.here.platform.examples.location.batch.Main$.main (Main.scala:24)
    at com.here.platform.examples.location.batch.Main.main (Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:748)
1

There are 1 best solutions below

0
On

Good question Ken.

The error you’re experiencing is a simple omission in the execution arguments on your maven build.

Add the following to your maven line:

-Dexec.args=--master local[*]

For example:

mvn exec:java -Dexec.cleanupDaemonThreads=false
-Dexec.mainClass=com.here.platform.examples.location.batch.Main
"-Dexec.args=--master local[*]"
-Dpipeline-config.file=config/pipeline-config.conf
-Dpipeline-job.file=config/pipeline-job.conf