Hadoop Library is imported but cannot set the “get” method in FyleSystem

Hadoop Library is imported but cannot set the “get” method in FyleSystem

I'm trying to setting up a call to HDFS to get a file from it using FileSystem to do so:

I'm trying to setting up a call to HDFS to get a file from it using FileSystem to do so:

FileSystem fs = new FileSystem.get(new URI.create(uri), conf);

But I getting this two errors even so I called all the libraries

    Error:(46, 39) java: cannot find symbol
    symbol:   class get
    location: class org.apache.hadoop.fs.FileSystem

Error:(46, 47) java: cannot find symbol
symbol:   method create(java.lang.String)
location: class org.apache.commons.httpclient.URI

This is for hadoop 2.7.7 version. I already tried imported the hole library org.apache.hadoop.fs.;but still the method get and create is not there when I'm trying to use them in the line as follow: FileSystem fs = new FileSystem.get(URI.create(usi), conf)

import org.apache.commons.httpclient.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;   

public class Test { public static void main(String []args) {

String uri = "hdfs://localhost:9000/data.json";
Configuration conf = new Configuration();

//cannot find symbol get
//Cannot find symbol create
FileSystem fs = new FileSystem.get(new URI.create(uri), conf);

InputStream in = null;

try {
    in = fs.open(new Path(uri));
    IOUtils.copyBytes(in, System.out, 4096, false);
} catch (IOException e) {
    e.printStackTrace();
} finally {
    IOUtils.closeStream(in);
}

} }

And here is my POM.xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.boeing.bedl</groupId> <artifactId>IngestionData</artifactId> <version>1.0-SNAPSHOT</version>

<dependencies> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-common</artifactId> <version>2.7.7</version> </dependency>

&lt;dependency&gt;
    &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt;
    &lt;artifactId&gt;hadoop-yarn-common&lt;/artifactId&gt;
    &lt;version&gt;2.7.7&lt;/version&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
    &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt;
    &lt;artifactId&gt;hadoop-mapreduce-client-core&lt;/artifactId&gt;
    &lt;version&gt;2.7.7&lt;/version&gt;
&lt;/dependency&gt;

&lt;dependency&gt;
    &lt;groupId&gt;org.apache.hadoop&lt;/groupId&gt;
    &lt;artifactId&gt;hadoop-mapreduce-client-common&lt;/artifactId&gt;
    &lt;version&gt;2.7.7&lt;/version&gt;
&lt;/dependency&gt;

</dependencies> </project>


java maven hadoop

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Java Core (2020) | Java for beginners | Brush up your Java Skills | Get Hired

In this video we will learn about all the major concepts that come under Java Core . The course is very carefully designed and is made with keeping simplicit...

Accessing Maven Properties in Java

Learn how to access Maven properties in Java. In this short tutorial, we'll take a look at how to use variables defined inside Maven's _pom.xml_ from a Java application.

Run a Java Main Method in Maven

Learn how to run Java main method using Maven. In this short tutorial, we're going to see how to run arbitrary main methods from any Java class using Maven.

Java File Class Tutorial | Java.io File Class in Java Example

Java File class represents the path of directories and files. It provides the methods for renaming, deleting, and obtaining the properties of file or directory.