问题描述:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/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:123) Caused by: java.lang.ClassNotFoundException: org.apache.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
原因:
pom.xml中的依赖配置错误
解决方案:
<dependency> <groupId>org.apache.storm</groupId> <artifactId>storm-core</artifactId> <version>1.2.3</version> <scope>provided</scope> </dependency>
本地运行时将<scope>provided</scope>去掉即可(打包时再加上)