user5520049
user5520049

Reputation:

java.lang.NoClassDefFoundError: org/yaml

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

Upvotes: 4

Views: 27888

Answers (2)

Sanjay Das
Sanjay Das

Reputation: 190

<!-- 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>

Upvotes: 2

Nietzsche
Nietzsche

Reputation: 889

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>

```

Upvotes: 6

Related Questions