Exception in thread "main" java.lang.NoSuchMethodError: io.netty.buffer.PooledByteBufAllocator.(ZIIIIIIIZ)V

刘超 2月前 ⋅ 352 阅读   编辑

一、描述

  spark2.0.1执行spark程序,报如下错误

Exception in thread "main" java.lang.NoSuchMethodError: io.netty.buffer.PooledByteBufAllocator.(ZIIIIIIIZ)V
 at org.apache.spark.network.util.NettyUtils.createPooledByteBufAllocator(NettyUtils.java:120)
 at org.apache.spark.network.client.TransportClientFactory.(TransportClientFactory.java:106)
 at org.apache.spark.network.TransportContext.createClientFactory(TransportContext.java:99)
 at org.apache.spark.rpc.netty.NettyRpcEnv.(NettyRpcEnv.scala:71)
 at org.apache.spark.rpc.netty.NettyRpcEnvFactory.create(NettyRpcEnv.scala:461)
 at org.apache.spark.rpc.RpcEnv$.create(RpcEnv.scala:57)
 at org.apache.spark.SparkEnv$.create(SparkEnv.scala:249)
 at org.apache.spark.SparkEnv$.createDriverEnv(SparkEnv.scala:175)
 at org.apache.spark.SparkContext.createSparkEnv(SparkContext.scala:257)
 at org.apache.spark.SparkContext.(SparkContext.scala:424)
 at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2520)
 at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:935)
 at org.apache.spark.sql.SparkSession$Builder$$anonfun$7.apply(SparkSession.scala:926)
 at scala.Option.getOrElse(Option.scala:121)
 at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:926)
 at net.itdiandi.batch.spark.checkout.CheckPointDemo$.main(CheckPointDemo.scala:7)
 at net.itdiandi.batch.spark.checkout.CheckPointDemo.main(CheckPointDemo.scala)

二、解决方法

  修改pom.xml文件,将

<parent>
  <artifactId>DianDiExample</artifactId>
  <groupId>net.itdiandi</groupId>
  <version>0.1-SNAPSHOT</version>
</parent>

  改为

<dependency>
  <groupId>net.itdiandi</groupId>
  <artifactId>DianDiExample</artifactId>
  <version>0.1-SNAPSHOT</version>
  <exclusions>
    <exclusion>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-dist_2.11</artifactId>
    </exclusion>
    <exclusion>
      <groupId>io.netty</groupId>
      <artifactId>netty-buffer</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>io.netty</groupId>
  <artifactId>netty-all</artifactId>
  <version>4.1.17.Final</version>
</dependency>


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: