I'm beginner of storm and intellij idea,when I import storm-starter(apache-storm-0.9.5.zip) to intellij idea(14 CE OS),everything is OK,but when I run the "ExclamationTopology" ,a problem appears as follow:
Exception in thread "main" java.lang.NoClassDefFoundError: backtype/storm/topology/IRichSpout
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
Process finished with exit code 1
this interface is from storm-core,but this maven managed jar is in my library Why does this happened..?
Strom already has required jar on the server side. So, if look into the pom.xml you find something similar to: https://github.com/apache/storm/blob/master/examples/storm-starter/pom.xml
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>${project.version}</version>
<!-- keep storm out of the jar-with-dependencies -->
<scope>provided</scope>
</dependency>
The provided scope is only available on the compilation and test classpath. Because of it your project compiles, but then fails in the runtime with exception : java.lang.NoClassDefFoundError.
Please, comment the scope line in your pom.xml and update maven dependencies to solve this problem. It should looks like:
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>${project.version}</version>
<!-- keep storm out of the jar-with-dependencies -->
<!-- <scope>provided</scope> -->
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With