title: Flume sink to HDFS error: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument
body: <p>With:</p>
  
  <ul>
  <li>Java 1.8.0_231</li>
  <li>Hadoop 3.2.1</li>
  <li>Flume 1.8.0</li>
  </ul>
  
  <p>Have created a hdfs service on 9000 port.</p>
  
  <p>jps:</p>
  
  <pre><code>11688 DataNode
  10120 Jps
  11465 NameNode
  11964 SecondaryNameNode
  12621 NodeManager
  12239 ResourceManager
  </code></pre>
  
  <p>Flume conf:</p>
  
  <pre><code>agent1.channels.memory-channel.type=memory
  agent1.sources.tail-source.type=exec
  agent1.sources.tail-source.command=tail -F /var/log/nginx/access.log
  agent1.sources.tail-source.channels=memory-channel
  
  #hdfs sink
  agent1.sinks.hdfs-sink.channel=memory-channel
  agent1.sinks.hdfs-sink.type=hdfs
  agent1.sinks.hdfs-sink.hdfs.path=hdfs://cluster01:9000/system.log
  agent1.sinks.hdfs-sink.hdfs.fileType=DataStream
  agent1.channels=memory-channel
  agent1.sources=tail-source
  agent1.sinks=log-sink hdfs-sink
  </code></pre>
  
  <p>Then start flume:</p>
  
  <pre><code>./bin/flume-ng agent --conf conf -conf-file conf/test1.conf --name agent1 -Dflume.root.logger=INFO,console
  </code></pre>
  
  <p>Then meet error:</p>
  
  <pre><code>Info: Including Hadoop libraries found via (/usr/local/hadoop-3.2.1/bin/hadoop) for HDFS access
  ...
  2019-11-04 14:48:24,818 (lifecycleSupervisor-1-1) [INFO - org.apache.flume.instrumentation.MonitoredCounterGroup.start(MonitoredCounterGroup.java:95)] Component type: SINK, name: hdfs-sink started
  2019-11-04 14:48:28,823 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.hdfs.HDFSDataStream.configure(HDFSDataStream.java:57)] Serializer = TEXT, UseRawLocalFileSystem = false
  2019-11-04 14:48:28,836 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:447)] 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: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)
  </code></pre>
  
  <p>I have searched for a while but haven't found same error on net. Is there any advice to solve this problem?</p>