简体   繁体   English

Apache Spark:Scala示例问题

[英]Apache Spark: issue with Scala example

I'm trying to learn to use Apache Spark and I have a problem with a simple example but I can not find a solution. 我正在尝试学习使用Apache Spark,但我有一个简单的示例有问题,但找不到解决方案。 I'm working on Ubuntu 13.04 with Java-7-Oracle and scala 2.9.3. 我正在使用Java-7-Oracle和Scala 2.9.3在Ubuntu 13.04上工作。 When I try to run SparkPi examples I get this output: 当我尝试运行SparkPi示例时,得到以下输出:

filippo@filippo-HP-Pavilion-dv6-Notebook-PC:/usr/local/spark$ ./bin/run-example SparkPi 10
java.lang.ClassNotFoundException: org.apache.spark.examples.SparkPi
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:337)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:75)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties

This is the example show in Spark documentation but I don't understand what is the problem :( 这是Spark文档中的示例显示,但我不明白问题出在哪里:(

You may have downloaded a source release rather than a pre-built? 您可能已经下载了源版本,而不是预先构建的?

To build and assemble with sbt, you can run sbt assembly in the spark root directory. 要使用sbt进行构建和组装,您可以在spark根目录中运行sbt assembly

Your installation directory is /usr/local/spark, which doesn't contain the required class. 您的安装目录为/ usr / local / spark,其中不包含必需的类。

Try just extract the downloaded tgz file from http://spark.apache.org/downloads.html . 尝试仅从http://spark.apache.org/downloads.html中提取下载的tgz文件。 Cd to the directory and run the example command. 将CD复制到目录并运行example命令。

Make sure that you have lib/spark-examples-XXX-YYY.jar when you run bin/run-example 运行bin / run-example时,请确保您具有lib / spark-examples-XXX-YYY.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM