zoukankan      html  css  js  c++  java
  • problems_spark

    1 执行sparksql报错

    报错内容如下:
    org.apache.spark.sql.AnalysisException: Unable to generate an encoder for inner class cn.develop.spark.sql.Intro$Person without access to the scope that this class was defined in.Try moving this class out of its parent class.

    解决方法:将case class Person(name:String,age:Int)这个样例类移动到父类的外面,就是移到最外面,不要让其包含在任何的类中。

    2 wordcount程序报错

    报错内容如下:
    Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrder
    解决步骤:

    1. 根据网上的方法,在maven中添加如下依赖:
    <dependency>
              <groupId>com.fasterxml.jackson.core</groupId>
              <artifactId>jackson-core</artifactId>
              <version>2.2.4</version>
          </dependency>
          <dependency>
              <groupId>com.fasterxml.jackson.core</groupId>
              <artifactId>jackson-databind</artifactId>
              <version>2.2.4</version>
          </dependency>
    
    1. 再次执行,又报以下错误:
      Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.module.scala.deser.BigDecimalDeserializer$.handledType()Ljava/lang/Class;
      根据网上方法,maven中删除之前添加的依赖,改为添加以下依赖:
    <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-scala_2.11</artifactId>
                <version>2.7.4</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-jaxb-annotations</artifactId>
                <version>2.7.4</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.7.4</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>2.7.4</version>
            </dependency>
    

    3

    4

    5

    6

    7

  • 相关阅读:
    overflow :hidden隐藏溢出用处大
    datalist 数据展示顺序
    SEO 特定搜索和外链技巧
    Android网络地址簿同步的方式
    表单全选及取消全选
    for循环的嵌套之小星星。
    数组的方法中那些会改变原数组呢?
    for循环的嵌套之打印倒三角的星星
    Js中的排他思想
    计算阶乘的思路。
  • 原文地址:https://www.cnblogs.com/mediocreWorld/p/15178478.html
Copyright © 2011-2022 走看看