【问题标题】:why is it so hard to run simple spark streaming ? spark 1.1.1 Maven dependency为什么运行简单的火花流这么难? spark 1.1.1 Maven 依赖
【发布时间】:2014-12-11 04:43:36
【问题描述】:

我正在使用 spark 流,当我使用 spark1.0.2 时它工作正常,现在我反复遇到一些问题

没有找到类似的类,我使用相同的 pom.xml 和所有 spark 模块的更新版本 我正在使用 spark-core、streaming、streaming 和 kafka 模块..

它不断抛出错误,因为没有公共配置、公共语言、日志记录

如何获取运行 spark 流的所有依赖项。有没有什么办法,或者我们只能通过反复试验的方法找到?

我的 pom 依赖项

<dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency> 
        <dependency> <!-- Spark dependency -->
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_2.10</artifactId>
      <version>1.1.1</version>
    </dependency>

  <dependency> <!-- Spark streaming dependency -->
  <groupId>org.apache.spark</groupId>
  <artifactId>spark-streaming_2.10</artifactId>
  <version>1.1.1</version>
</dependency>
  <dependency> <!-- Spark dependency -->
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-streaming-kafka_2.10</artifactId>
      <version>1.1.1</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.5</version>
    </dependency>
        <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
</dependency>
<dependency>
    <groupId>commons-configuration</groupId>
    <artifactId>commons-configuration</artifactId>
    <version>1.6</version>
</dependency>

    </dependencies>

我在这里错过了什么吗?

【问题讨论】:

    标签: apache-spark spark-streaming


    【解决方案1】:

    您的 pom.xml 仍然使用 spark-core 版本 1.0.2。 pom.xml 中所有与 spark 相关的依赖项请使用 1.1.1 版本。

    【讨论】:

    • 感谢您的回复已将我的 pom 更新为最新版本,但是我不断收到 java.lang.ClassNotFoundException: org.apache.commons.lang3.SystemUtils for diff jars
    • 现在我得到 java.lang.ClassNotFoundException: org.slf4j.spi.LoggerFactoryBinder 但我已经添加了 slf4j-log4j12 依赖..不知道我现在应该做什么..任何指针..试过将范围作为运行时也没有运气
    • 确保提交一个包含所有依赖项的 fat jar。
    • 我包含了所有的 jars,我也得到了无效的类异常
    • 好。你能检查一下你的 log4j 版本和 spark/hadoop 的 lig4j 版本吗?
    【解决方案2】:

    在浪费了很多时间之后,我终于找到了答案。

    1.确保你的spark版本和你pom中的版本是一样的 2.spark的Hadoop版本是spark构建的版本或者使用spark hadoop prebuild版本 3.使用所需的详细信息更新您的 spark env .sh

    export JAVA_HOME=/User/java/
    export SPARK_MASTER_IP=xyz
    export SPARK_WORKER_CORES=2
    export SPARK_WORKER_INSTANCES=1
    export SPARK_MASTER_PORT=7077
    export SPARK_WORKER_MEMORY=4g
    export MASTER=spark://${SPARK_MASTER_IP}:${SPARK_MASTER_PORT}
    export SPARK_LOCAL_IP=xyz
    

    4.如果你使用 maven 和 eclipse 使用 m2e 1.5 版本,否则你一定会得到 log4j 异常。 5.确保每次在代码提交 Spark 应用程序之前清理编译包你的 jar 文件

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-15
      • 2014-12-19
      • 2016-11-12
      • 1970-01-01
      • 1970-01-01
      • 2022-01-14
      • 1970-01-01
      相关资源
      最近更新 更多