Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout

Posted --->别先生<---

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout相关的知识,希望对你有一定的参考价值。

1:初次运行Strom程序出现如下所示的错误,贴一下,方便脑补,也希望帮助到看到的小伙伴:

错误如下所示,主要问题是刚开始使用maven获取jar包的时候需要写<scope>provided</scope>,运行的时候需要把这行注释了即可,这是作用域的问题,开始需要在本地下载jar包,但是在虚拟机运行的时候已经存在这些jar包了,所以再写这句话就冲突了:

 1 java.lang.NoClassDefFoundError: backtype/storm/topology/IRichSpout
 2     at java.lang.Class.getDeclaredMethods0(Native Method)
 3     at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
 4     at java.lang.Class.getMethod0(Class.java:2866)
 5     at java.lang.Class.getMethod(Class.java:1676)
 6     at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
 7     at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
 8 Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout
 9     at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
10     at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
11     at java.security.AccessController.doPrivileged(Native Method)
12     at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
13     at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
14     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
15     at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
16     ... 6 more
17 Exception in thread "main" 
18 Process finished with exit code 1

解决方法如下所示:

 贴下pom.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<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.bie</groupId>
    <artifactId>storm</artifactId>
    <version>1.0-SNAPSHOT</version>

    <!-- storm的依赖关系 -->
    <dependencies>
        <dependency>
            <groupId>org.apache.storm</groupId>
            <artifactId>storm-core</artifactId>
            <version>0.9.5</version>
            <!--<scope>provided</scope>-->
        </dependency>
    </dependencies>

    <!--如果依赖外部包,就打不进去外部包,所以需要引入下面所示-->
    <build>
        <plugins>
            <plugin>
                <!--把其他外部依赖的jar包打成一个大jar包-->
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.bie.wordcount.WordCountTopologyMain</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

停更......

以上是关于Caused by: java.lang.ClassNotFoundException: backtype.storm.topology.IRichSpout的主要内容,如果未能解决你的问题,请参考以下文章

Mathematical Problems Caused by CCD

Caused by SSLError

Caused by: java.lang.NoClassDefFoundError:

caused by a circular import.

异常Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationExcep

Caused by org hibernate DuplicateMappingException Duplicat