Today, I encountered a problem when I was analyzing the project case on the learning log website, and I recorded the solution here.
PS: For specific project operations, please see Hadoop Learning - Log Website Analysis Project Case
There are very specific projects in it, and Wei has successfully implemented it in his distributed hadoop environment step by step. I am very grateful to the author of that blog.
Let me tell you how to solve when we encounter the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/fs/FileSystem
1. Take out and modify the core-default.xml file in hadoop-commom-x.jar, and add the following code:
<
property
>
<
name
>fs.hdfs.impl</
name
>
<
value
>org.apache.hadoop.hdfs.DistributedFileSystem</
value
>
<
description
>The FileSystem for hdfs: uris.</
description
>
</
property
>
|
Configuration configuration = new Configuration(); configuration.set("fs.hdfs.impl",org.apache.hadoop.hdfs.DistributedFileSystem.class.getName()); configuration.set("fs.file.impl",org.apache.hadoop.fs.LocalFileSystem.class.getName());