Stormtrooper with intellij idea, maven project could not find class

I start a storm with an intuitive idea, when I import a storm starter (apache-storm-0.9.5.zip) into an intuitive idea (14 CE OS), everything is fine, but when I run "ExclamationTopology" ", the problem arises:

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 the storm core, but this bank-driven maven is in my library Why did this happen ??

+3
source share
1 answer

Strom already had the required bank on the server side. So, if you look at pom.xml, you will 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 scope provided is only available through compilation and testing. Because of this, your project compiles, but then fails at runtime with the exception: java.lang.NoClassDefFoundError.

Please comment out the scope line in pom.xml and update the maven dependencies to solve this problem. It should look like this:

 <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> 
+6
source

All Articles