我是java和storm的新手,我正试图在风暴本地集群中运行一个项目。第一个项目中存在拓扑流道和螺栓,第二个项目中存在喷口。第二个项目的jar作为依赖项存在于第一个项目的pom中,并且它在eclipse中正常工作。但是当我尝试打包第一个项目并在第一个项目jar上执行storm jar命令时,它会在spout类上给出NoClassDefFound错误。无法弄清楚原因。任何帮助将不胜感激。
我的错误:
Exception in thread "main" java.lang.NoClassDefFoundError: nl/minvenj/nfi/storm/kafka/KafkaSpout
at com.wincere.lamda.storm.TopologyRunner.main(TopologyRunner.java:15)
Caused by: java.lang.ClassNotFoundException: nl.minvenj.nfi.storm.kafka.KafkaSpout**
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 1 more
我的Pom文件
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven- 4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>storm_separate</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>storm_separate</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.minvenj.nfi.storm</groupId>
<artifactId>kafka-spout</artifactId>
<version>0.2-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${projectdir}/lib/kafka-spout-0.2-SNAPSHOT.jar</systemPath>
</dependency>
<dependency>
<groupId>storm</groupId>
<artifactId>storm</artifactId>
<version>0.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>vertica</groupId>
<artifactId>vertica-jdbc</artifactId>
<version>7.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.8.1</version>
<exclusions>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.yammer.metrics</groupId>
<artifactId>metrics-annotation</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
</project>
正确指定了projectdir。
我正在使用风暴0.9.2孵化来在我的机器上创建风暴集群