完整报错内容:
24-Nov-2023 14:26:05.157 [RMI TCP Connection(2)-127.0.0.1] ERROR o.s.b.SpringApplication - [reportFailure,858] - Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.ruoyi.RuoYiApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
Caused by: java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
24-Nov-2023 14:26:05.165 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ruoyi_admin_war_exploded]]
at……
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.ruoyi.RuoYiApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
Caused by: java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
24-Nov-2023 14:26:05.169 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method manageApp
java.lang.IllegalStateException: 启动子级时出错
at……
Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ruoyi_admin_war_exploded]]
at……
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.ruoyi.RuoYiApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
Caused by: java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
24-Nov-2023 14:26:05.186 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method createStandardContext
javax.management.RuntimeOperationsException: Exception invoking method manageApp
at……
Caused by: java.lang.IllegalStateException: 启动子级时出错
at……
Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ruoyi_admin_war_exploded]]
at……
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.ruoyi.RuoYiApplication]; nested exception is java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
Caused by: java.io.FileNotFoundException: class path resource [com/ruoyi/common/core/controller/BaseController.class] cannot be opened because it does not exist
at……
[2023-11-24 02:26:05,250] Artifact ruoyi-admin:war exploded: Error during artifact deployment. See server log for details.
在Tomcat和maven都配置好的情况下,将项目打包到Tomcat发布出现以上报错。
检查前期操作:
1. 检查环境变量
(1)maven
我的电脑(右键)->属性->高级系统设置->环境变量:
- 检查系统变量MAVEN_HOME的变量值路径是否正确
- 检查系统变量PATH中关于MAVEN的路径是否正确
(2)Tomcat
- 检查系统变量CATALINA_HOME的变量值路径是否正确
- 检查系统变量PATH中关于CATALINA的路径是否正确
2.检查IDEA
File->Settings->Maven:
- 检查Maven home、setting.xml文件和本地仓库的路径是否正确
File->Project Structure->Artifacts:
-
检查ruoyi-admin:war exploded是否存在
-
如果不存在,左上角“+”->Web Application:Exploded->From Modules添加ruoyi-admin,Apply->OK
Run->Edit Configurations…
-
检查左侧是否配置Tomcat Server
-
没有就左上角“+”,找到Tomcat Server,选择Local
-
检查Deployment中是否配置刚刚Artifacts中添加的ruoyi-admin:war exploded
-
没有就添加,然后Apply->OK
3. 出现bug
如果以上配置均无问题,并且maven仓库已经下载好依赖的情况下出现了该报错,可以尝试以下方法:
ruoyi-admin中的pom.xml文件
- 大概11行的位置,jar改成war
- 然后就是比较随机的操作了,以下操作任选(最好一个个试),有的重启IDEA就可以,有的删掉.idea才可以
1.maven clean,然后package
2.重启IDEA
3.重启电脑
4.【迫不得已】删掉根目录的.idea文件,重启IDEA(需要重新在IDEA里配置maven和Tomcat)
OK.