flume采集kafka到hdfs遇到的问题2
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:226) at org.apache.flume.sink.hdfs.BucketWriter.append(BucketWriter.java:541) at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:401) 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:226) at org.apache.flume.sink.hdfs.BucketWriter.append(BucketWriter.java:541) at org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:401) 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)
报错信息:
遇到这种问题,无非两种情况,一是 丢失jar包,二是 jar包冲突。
由于对hadoop以及flume版本选择比较随意。猜测是jar包存在冲突。找到报错类 com.google.common.base.Preconditions ,通过查询 该类存在 guava jar包中。
flume的lib中 /opt/flume/apache-flume-1.9.0-bin/lib (guava-11.0.2.jar),
而 hadoop 的 lib 中 /opt/hadoop/hadoop-3.2.1/share/hadoop/common/lib/ (guava-27.0-jre.jar),
删除版本低的,并拷贝高版本的。 问题解决。