无法执行依赖maven的jar文件

qc6wkl3g  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(427)

我试图执行jar文件,但它显示以下错误: java -jar HDFSTest1-1.0-SNAPSHOT.jar ```
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/hadoop/conf/Configuration
at hdfstest1.HDFSTestGUI1.(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

这是我的pom.xml


4.0.0
com.mycompany
HDFSTest1
1.0-SNAPSHOT
jar


org.apache.hadoop
hadoop-core
1.2.1


org.jdesktop
beansbinding
1.2.1



<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
hdfstest1.HDFSTestGUI1





org.apache.maven.plugins
maven-jar-plugin
3.0.2



true
lib/
hdfstest1.HDFSTestGUI1





org.apache.maven.plugins
maven-compiler-plugin
3.6.1


maven-assembly-plugin



hdfstest1.HDFSTestGUI1






清单.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

我已经尝试了互联网上几乎所有的解决方案,但我认为我遗漏了一些我在这里无法理解的东西。有人能帮助理解这个吗?提前谢谢!!
我已经使用了hadoop-core.jar(1.2.1),它包括所有模块,如mapreduce、hadoop common等。我需要显式地添加它吗?
o7jaxewo

o7jaxewo1#

不应该 $HADOOP_HOME/bin/hadoop jar HDFSTest1-1.0-SNAPSHOT.jar 命令可以用于运行hadoop作业吗?
如果类路径中的所有jar都很好,那么除了这个之外,我看不到任何其他错误。

相关问题