ClassNotFoundException:org.rainbow.spring.boot.Application

项目启动报错:

Exception in thread "main" java.lang.ClassNotFoundException: org.rainbow.spring.boot.Application
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:93)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)

报错原因

pom中没有配置启动类

jar包启动配置文件


可以看到jar包中MANIFEST.MF文件中的启动类是:org.rainbow.spring.boot.Application

修正配置文件

在打包配置中加入启动类配置

<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>com.xx.xx.MobileWebApplication</mainClass>
                </configuration>
            </plugin>
        </plugins>

修改后的jar包中MANIFEST.MF文件的启动类就是配置的启动类

然后启动就不报错咯

# java   springboot   error   配置  

评论

企鹅群:39438021

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×