如下方式运行jar包:
java -Xmx200m -Xms100m -classpath /hadoop/software/apache-flume-1.9.0-bin/project/dataplat-ipva-local.jar com.winnerinf.dataplat.hdfs.DataCollectionFailover
报错如下:
Exception in thread "main" org.apache.hadoop.fs.UnsupportedFileSystemException: No FileSystem for scheme "hdfs"
at org.apache.hadoop.fs.FileSystem.getFileSystemClass(FileSystem.java:3281)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:3301)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:124)
at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:3352)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3320)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:479)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:227)
at com.winnerinf.dataplat.hdfs.S0400DataCollectionFailover.main(S0400DataCollectionFailover.java:121)
解决:
在配置文件core-site.xml中添加如下配置信息:
<property>
<name>fs.hdfs.impl</name>
<value>org.apache.hadoop.hdfs.DistributedFileSystem</value>
<description>The FileSystem for hdfs: uris.</description>
</property>