2017-05-14 5 views
0

내가 jar 파일을 실행하려고하지만 오류 아래 보여줍니다 여기에수 없습니다

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration 
at hdfstest1.HDFSTestGUI1.<init>(HDFSTestGUI1.java:48) 
at hdfstest1.HDFSTestGUI1$17.run(HDFSTestGUI1.java:561) 
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) 
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) 
at java.awt.EventQueue.access$500(EventQueue.java:97) 
at java.awt.EventQueue$3.run(EventQueue.java:709) 
at java.awt.EventQueue$3.run(EventQueue.java:703) 
at java.security.AccessController.doPrivileged(Native Method) 
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) 
at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) 
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) 
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) 
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) 
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) 
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) 
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 
Caused by: java.lang.ClassNotFoundException: 
org.apache.hadoop.conf.Configuration 
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
... 16 more 

java -jar HDFSTest1-1.0-SNAPSHOT.jar가 내 pom.xml 파일

<?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.mycompany</groupId> 
<artifactId>HDFSTest1</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>jar</packaging> 
<dependencies> 
    <dependency> 
     <groupId>org.apache.hadoop</groupId> 
     <artifactId>hadoop-core</artifactId> 
     <version>1.2.1</version> 
    </dependency> 
    <dependency> 
     <groupId>org.jdesktop</groupId> 
     <artifactId>beansbinding</artifactId> 
     <version>1.2.1</version> 
    </dependency> 
</dependencies> 
<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <maven.compiler.source>1.8</maven.compiler.source> 
    <maven.compiler.target>1.8</maven.compiler.target> 
    <mainClass>hdfstest1.HDFSTestGUI1</mainClass> 
</properties> 
<build> 
    <plugins> 
     <plugin> 
      <!-- Build an executable JAR --> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <version>3.0.2</version> 
      <configuration> 
       <archive> 
        <manifest> 
         <addClasspath>true</addClasspath> 
         <classpathPrefix>lib/</classpathPrefix> 
         <mainClass>hdfstest1.HDFSTestGUI1</mainClass> 
        </manifest> 
       </archive> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.6.1</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <configuration> 
       <archive> 
        <manifest> 
         <mainClass>hdfstest1.HDFSTestGUI1</mainClass> 
        </manifest> 
       </archive> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
</project> 

Manifest.mf :

Manifest-Version: 1.0 
Built-By: dipsi 
Class-Path: hadoop-core-1.2.1.jar commons-cli-1.2.jar xmlenc-0.52.jar 
jersey-core-1.8.jar jersey-json-1.8.jar jettison-1.1.jar stax-api-1.0 
.1.jar jaxb-impl-2.2.3-1.jar jaxb-api-2.2.2.jar stax-api-1.0-2.jar ac 
tivation-1.1.jar jackson-core-asl-1.7.1.jar jackson-jaxrs-1.7.1.jar j 
ackson-xc-1.7.1.jar jersey-server-1.8.jar asm-3.1.jar commons-io-2.1. 
jar commons-httpclient-3.0.1.jar junit-3.8.1.jar commons-logging-1.0. 
3.jar commons-codec-1.4.jar commons-math-2.1.jar commons-configuratio 
n-1.6.jar commons-collections-3.2.1.jar commons-lang-2.4.jar commons- 
digester-1.8.jar commons-beanutils-1.7.0.jar commons-beanutils-core-1 
.8.0.jar commons-net-1.4.1.jar jetty-6.1.26.jar servlet-api-2.5-20081 
211.jar jetty-util-6.1.26.jar jasper-runtime-5.5.12.jar jasper-compil 
er-5.5.12.jar jsp-api-2.1-6.1.14.jar servlet-api-2.5-6.1.14.jar jsp-2 
.1-6.1.14.jar ant-1.6.5.jar commons-el-1.0.jar jets3t-0.6.1.jar hsqld 
b-1.8.0.10.jar oro-2.0.8.jar core-3.1.1.jar jackson-mapper-asl-1.8.8. 

jar beansbinding-1.2.1.jar 
Created-By: Apache Maven 3.0.5 
Build-Jdk: 1.8.0_121 
Main-Class: hdfstest1.HDFSTestGUI1 

나는 인터넷에서 사용할 수있는 거의 모든 솔루션을 시도했지만 여기서 내가 이해할 수없는 것을 놓치고 있다고 생각합니다. 누군가가 이것을 이해하는 데 도움이 될 수 있습니까? 미리 감사드립니다 !!

mapreduce, hadoop-common 등과 같은 모든 모듈을 포함하는 hadoop-core.jar (1.2.1)을 사용했습니다. 명시 적으로 추가해야합니까?

+1

가능한 [org.apache.hadoop.conf.Configuration의 중복은 hadoop-core.jar에 존재하지 않습니다] (http://stackoverflow.com/questions/18414151/org-apache-hadoop-conf-configuration-does) -nou-exist-in-hadoop-core-jar) – sinclair

+0

@sinclair hadoop-core.jar를 이미 사용하고 있습니다. 1.2.1에는 hadoop-common 패키지가 포함되어 있습니다. –

+0

모든 종속성을 포함하는 uber-jar입니까? –

답변

0

hadoop 작업을 실행하기 위해 $HADOOP_HOME/bin/hadoop jar HDFSTest1-1.0-SNAPSHOT.jar 명령을 사용해야합니까?

클래스 패스에서 모든 jar 파일이 잘된 경우 다른 오류는 표시되지 않습니다.