java.lang.NoClassDefFoundError:org/yaml [英] java.lang.NoClassDefFoundError: org/yaml
问题描述
我是使用Storm尝试提交Storm-starter的新手,但是当我
I'm new in using storm trying to submit storm-starter but when i
mvn package
我遇到了这个错误
java.lang.NoClassDefFoundError: org/yaml/snakeyaml/constructor/BaseConstructor,
compiling:(word_count.clj:16:1)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
推荐答案
当遇到类似您所遇到的ClassPath错误时,一个常见的问题是您可能会与传递依赖项发生冲突.即,至少有两个工件提供了不同版本的未找到的类",您需要排除发生冲突的一个.因此,您必须确定碰撞,例如在行家中做:mvn依赖项:tree -Dverbose
并在您的情况下查找冲突的工件,即uri:org/yaml/snakeyaml/constructor/BaseConstructor
标识Maven坐标,groupId = org.yaml和artifactId = snakeyaml,您会发现您的案例中的测试"工件正在提供另一个snakeyaml,因此像对该工件的依赖项一样添加了排除项:```
A common problem when getting a ClassPath error like the one you got, is that you might have a collision from transitive dependencies; i.e., there's at least two artifacts that are providing different versions of the Class Not Found, you need to exclude the colliding one. So you have to identify the collision, e.g. in maven do:
mvn dependency:tree -Dverbose
and look for the colliding artifact, in your case the uri:
org/yaml/snakeyaml/constructor/BaseConstructor
identifies maven coordinates, groupId=org.yaml, and artifactId=snakeyaml
, you'll find that the artifact "testing" in your case was providing another snakeyaml and thus add an exclusion as you did to that artifact's dependency:
```
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
```
这篇关于java.lang.NoClassDefFoundError:org/yaml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!