gpt4 book ai didi

java - HIPI测试运行由于NoclassdefinitionFound而失败

转载 作者:行者123 更新时间:2023-12-02 21:34:00 24 4
gpt4 key购买 nike

我一直在尝试在cloudera VM(cdh-5.4.2)上遵循the tutorial,但是在尝试运行内置jar来计算像素数时遇到异常。

构建本身成功:

[cloudera@quickstart helloWorld]$ gradle jar
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:examples:helloWorld:compileJava UP-TO-DATE
:examples:helloWorld:processResources UP-TO-DATE
:examples:helloWorld:classes UP-TO-DATE
:examples:helloWorld:jar

BUILD SUCCESSFUL

Total time: 18.436 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.7/userguide/gradle_daemon.html

但是执行jar会引发以下错误:
[cloudera@quickstart helloWorld]$ hadoop jar build/libs/helloWorld.jar examples/sampleNew.hib sampleimages_average
Exception in thread "main" java.lang.NoClassDefFoundError: org/hipi/imagebundle/mapreduce/HibInputFormat
at org.hipi.examples.HelloWorld.run(HelloWorld.java:106)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
at org.hipi.examples.HelloWorld.main(HelloWorld.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.lang.ClassNotFoundException: org.hipi.imagebundle.mapreduce.HibInputFormat
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more

我在同一根hipi父项目的示例文件夹中的此子项目的build.gradle如下:
 jar {
manifest {
attributes("Main-Class": "org.hipi.examples.HelloWorld")

}

dependencies{
compile project(':core')
}
}

有人可以帮助我我所缺少的内容以及如何使其运行吗?
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

由于我是gradle的新手,因此我无法在eclipse下配置hipi以便在其他项目中使用,因此我尝试仅通过终端运行。有人可以帮我吗?

注意:我的上网受到限制,因此我的系统几乎没有下载权限。

最佳答案

我已通过gradle将jar中的所有文件包括在内,从而解决了此问题,如下所示

jar {
manifest {
attributes("Main-Class": "org.hipi.examples.HelloWorld")
}

dependencies{
compile project(':core')
}

from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}

关于java - HIPI测试运行由于NoclassdefinitionFound而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33350091/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com