问题
I'm new in using storm trying to submit storm-starter but when i
mvn package
i got that error
java.lang.NoClassDefFoundError: org/yaml/snakeyaml/constructor/BaseConstructor,
compiling:(word_count.clj:16:1)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
POM file here in the link
回答1:
I found this solution: add this in pom
file.
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.2</version>
<type>jar</type>
<exclusions>
<exclusion>
<artifactId>snakeyaml</artifactId>
<groupId>org.yaml</groupId>
</exclusion>
</exclusions>
But exactly didn't know why !?
回答2:
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>
```
回答3:
<!-- just expanding/clarifying on the previous answer: -->
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.2</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
来源:https://stackoverflow.com/questions/33793441/java-lang-noclassdeffounderror-org-yaml