且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven 战争 - 无法启动组件 [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/] 构建 Maven 战争

更新时间:2021-12-10 02:25:42

几天后,终于找出问题所在.我认为这可能会帮助其他有类似问题的人.构建您的 .war 文件(通过 m2e-wtp 或控制台 mvn 包)后,maven 编译器从 src/main/webapp/WEB-INF/classes 文件夹而不是目标文件夹(target/projectName/WEB-INF/classes),从而报告导入错误,导致将 .war 文件部署到 tomcat 时出错.因此,只需从 WEB-INF 文件夹中删除 classes 文件夹,maven 会处理它.

After few days, finally figured out what was the problem. I thought this might help others with similar issues. After building your .war file (either through m2e-wtp, or console mvn package), maven compiler was picking up java classes out of src/main/webapp/WEB-INF/classes folder instead of target folder (target/projectName/WEB-INF/classes), and thus reporting errors on imports, which caused errors in deploying .war file to tomcat. So, just remove classes folder out of your WEB-INF folder, and maven will take care of it.