Skip to content

필사 모드: How to Fix Hadoop-Client NoClassDefFoundError (IntelliJ)

English
0%
정확도 0%
💡 왼쪽 원문을 읽으면서 오른쪽에 따라 써보세요. Tab 키로 힌트를 받을 수 있습니다.
원문 렌더가 준비되기 전까지 텍스트 가이드로 표시합니다.

Overview

When running a Java program that accesses a Hadoop cluster, the following error occurs.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration

at org.example.Main.main(Main.java:18)

Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration

at java.net.URLClassLoader.findClass(URLClassLoader.java:387)

at java.lang.ClassLoader.loadClass(ClassLoader.java:418)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)

at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

... 1 more

package org.example;

public class Main {

public static void main(String[] args) throws IOException {

Configuration configuration = new Configuration();

configuration.set("fs.defaultFS", "hdfs://my_hdfs_fqdn:8020");

FileSystem fileSystem = FileSystem.get(configuration);

String directoryName = "tmp/test";

Path path = new Path(directoryName);

fileSystem.mkdirs(path);

}

}

Solution

By commenting out the scope in the dependency, you can resolve the error where the class cannot be found.

<!-- <scope>provided</scope> -->

Quiz

Q1: What is the main topic covered in "How to Fix Hadoop-Client NoClassDefFoundError

(IntelliJ)"?

How to fix Hadoop-Client NoClassDefFoundError

By commenting out the scope in the dependency, you can resolve the error where the class cannot be

found.

현재 단락 (1/27)

When running a Java program that accesses a Hadoop cluster, the following error occurs.

작성 글자: 0원문 글자: 1,252작성 단락: 0/27