1. 程式人生 > >通過maven方式,war部署springboot專案遇到的bug總結

通過maven方式,war部署springboot專案遇到的bug總結

打包過程參考:http://how2j.cn/k/springboot/springboot-war/1655.html#nowhere

bug總結如下:

1.使用命令mvn clean package 報錯:java.lang.NoClassDefFoundError:org/springframework/boot/context/properties/source/ConfigurationPropertySource

解決方法:mvn clean package -Dmaven.test.skip=true 打包時忽略測試程式碼即可解決

2.報錯java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]

報錯原因:spring-webmvc的版本與spring-test的版本不一致

解決方法:使spring-webmvc的版本與spring-test的版本一致

3.將打包的ROOT.war部署到Tomcat/webapps 下,

報錯:org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].Standard

解決方法:刪去webapp下的ROOT資料夾