錯誤代碼:
嚴重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [springmvc.xml]; nested exception is java.io.FileNotFoundException: class path resource [springmvc.xml] cannot be opened because it does not exist
問題描述:
無法啓動tomcat,檢查target目錄發現存放在resources標記目錄下的*.xml配置文件沒有被打包進target目錄.
錯誤原因:
在pom文件中配置了其他位置的資源拷貝插件,漏過了resource文件
解決方法:
在pom.xml文件中(無論是當前項目的pom.xml還是父項目的pom.xml文件都有效)增加標籤
<build>
<resources>
<resource>
<directory>src/main/resource(資源目錄)</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
(build標籤已存在就把部分加到已存在的build標籤中)