gpt4 book ai didi

java - 找不到 org.apache.thrift7.TBase 类

转载 作者:行者123 更新时间:2023-11-29 09:00:29 25 4
gpt4 key购买 nike

使用以下 Maven 命令执行拓扑时出现错误:

mvn exec:java -Dexec.mainClass="com.test.newpackage.TopologyMain" -Dexec.args="resource/words.txt"

如果我尝试使用以下命令:

java -cp ./target/wordcount-0.0.1.jar:/usr/local/hadoop/storm/storm-0.8.1.jar:/usr/local/hadoop/storm/lib/*:/usr/local/hadoop/storm/conf/storm.yaml com.test.newpackage.TopologyMain resource/words.txt

它既不给出错误也不输出。即使在我使用以下方式将拓扑提交给 Storm 之后:

storm jar StormEclipse.jar com.test.newpackage.TopologyMain /resource/words.txt

此拓扑未在 ui(localhost:8080) 上列出。

 [INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.test.newpackage:wordcount:jar:0.0.1
[INFO] task-segment: [exec:java]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing exec:java
[INFO] No goals needed for project - skipping
[INFO] [exec:java {execution: default-cli}]
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: org/apache/thrift7/TBase
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:788)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at backtype.storm.topology.TopologyBuilder.initCommon(TopologyBuilder.java:215)
at backtype.storm.topology.TopologyBuilder.setSpout(TopologyBuilder.java:178)
at backtype.storm.topology.TopologyBuilder.setSpout(TopologyBuilder.java:164)
at com.test.newpackage.TopologyMain.main(TopologyMain.java:12)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.thrift7.TBase
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 21 more
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] An exception occured while executing the Java class. null

org.apache.thrift7.TBase
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Jul 22 18:55:23 IST 2013
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------

最佳答案

请检查 Storm 依赖的范围。示例 pom.xml storm wiki 中的建议设置要测试的范围。所以当你用maven执行时,会解析storm依赖失败。

删除测试范围,如果你想通过maven运行它

关于java - 找不到 org.apache.thrift7.TBase 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17789103/

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