• java.lang.reflect.InvocationTargetException at shade.com.datastax.spark.connector.google.common.base.Throwables.propagate(Throwables.java160)


    org.apache.spark.SparkException: Job aborted due to stage failure: Task 1 in stage 29.1 failed 4 times, most recent failure: Lost task 1.3 in stage 29.1 (TID 466, magnesium, executor 4): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at shade.com.datastax.spark.connector.google.common.base.Throwables.propagate(Throwables.java:160)
    at com.datastax.driver.core.NettyUtil.newEventLoopGroupInstance(NettyUtil.java:136)
    at com.datastax.driver.core.NettyOptions.eventLoopGroup(NettyOptions.java:99)
    at com.datastax.driver.core.Connection$Factory.(Connection.java:769)
    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1410)
    at com.datastax.driver.core.Cluster.init(Cluster.java:159)
    at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:330)
    at com.datastax.driver.core.Cluster.connect(Cluster.java:280)
    at StreamingIntegrationKafkaBac$$anonfun$main$1$$anonfun$apply$1.apply(StreamingIntegrationKafkaBac.scala:155)
    at StreamingIntegrationKafkaBac$$anonfun$main$1$$anonfun$apply$1.apply(StreamingIntegrationKafkaBac.scala:144)
    at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:935)
    at org.apache.spark.rdd.RDD$$anonfun$foreachPartition$1$$anonfun$apply$29.apply(RDD.scala:935)
    at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2074)
    at org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2074)
    at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
    at org.apache.spark.scheduler.Task.run(Task.scala:109)
    at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:345)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    我是在SparkStreaming查询Cassandra时遇到这个报错的。

    dataFrame.foreachPartition { part =>
      val poolingOptions = new PoolingOptions
      poolingOptions
        .setCoreConnectionsPerHost(HostDistance.LOCAL, 4)
        .setMaxConnectionsPerHost(HostDistance.LOCAL, 10)
      val cluster = Cluster
        .builder
        .addContactPoints("localhost")
        .withCredentials("cassandra", "cassandra")
        .withPoolingOptions(poolingOptions)
        .build
      val session = cluster.connect("keyspace")
      part.foreach { item =>
     	// 业务逻辑
      }
      cluster.close()
      session.close()
    }
    

    每个批次中,首先检查cluster和session,是否都close,没有close会报这个错误。

    若还没有解决,需要检查netty的版本。

    推荐在IDEA中安装Maven Helper插件。然后把冲突的低版本netty相关的依赖删掉即可。

  • 相关阅读:
    U盘引导Linux安装 CentOS .3
    Linux CentOS 6.3 网络连接 修复 虚拟机共享主机网络
    内存中“堆”和“栈”的区别
    求助帖--C++中单引号' '内多个字符是什么意思
    Cent Os6.3 设置中文输入法
    WPF中调用matlab制作的dll进行图像处理
    Python中的round()函数原理
    Eclipse+Pydev环境搭建
    5-4-shell:数组
    5-3-shell:流程控制--判断循环
  • 原文地址:https://www.cnblogs.com/icecola/p/11172556.html
Copyright © 2020-2023  润新知