flume启动报错:java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V

一、问题描述

  新部署的flume在启动时候报错:java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V


2020-06-30 11:40:20,359 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:459)] process failed
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
  at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357)
  at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338)
  at org.apache.hadoop.conf.Configuration.setBoolean(Configuration.java:1679)
  at org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:221)
  at org.apache.flume.sink.hdfs.BucketWriter.append(BucketWriter.java:572)
  at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:412)
  at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:67)
  at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145)
  at java.lang.Thread.run(Thread.java:748)
Exception in thread "SinkRunner-PollingRunner-DefaultSinkProcessor" java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
  at org.apache.hadoop.conf.Configuration.set(Configuration.java:1357)
  at org.apache.hadoop.conf.Configuration.set(Configuration.java:1338)
  at org.apache.hadoop.conf.Configuration.setBoolean(Configuration.java:1679)
  at org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:221)
  at org.apache.flume.sink.hdfs.BucketWriter.append(BucketWriter.java:572)
  at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:412)
  at org.apache.flume.sink.DefaultSinkProcessor.process(DefaultSinkProcessor.java:67)
  at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:145)

报错截图:

{F664C7E8-5A5F-4B93-8A03-B42B20BFEFF5}_20200630115354

问题解决:

一般这类问题,classNotFound,不是少jar包,那就是jar包冲突,查看flume安装目录下lib下面查看是有guava这个包的:

image

排除少包jar包的问题,那就是jar包冲突,在查看,本地环境hadoop目录下lib中也是有这个guava这个包:

image

显然是二者版本不一致导致的

问题解决:

找到原因之后,那就有解决办法了

将原有的flume中的低版本的guava包移除,然后拷贝hadoop/lib目录下的高版本的jar包到flume/lib中:

image

image

完成上述两步操作之后,然后重新启动flume,报错消失

posted @ 2020-06-30 13:46  郭小白  阅读(4399)  评论(0编辑  收藏  举报