所使用的IDE是IntelliJ IDEA粪薛。
IDEA中對框架的集成使得在搭建框架的時候只需要簡單的進行選擇。
圖片.png
但是在實踐的過程中發(fā)現(xiàn)了一個問題:
通過選擇模板來構(gòu)建框架墩剖,會產(chǎn)生所依賴的lib與工程脫軌,在編輯過程中不會出現(xiàn)問題(如報錯等),但是在運行的時候画饥,會出現(xiàn)依賴文件路徑相關(guān)的一些錯誤。
例如:因配置問題導(dǎo)致Tomcat啟動失敗等浊猾。
09-Apr-2017 22:11:21.202 嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file
09-Apr-2017 22:11:21.203 嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
而問題暫時表現(xiàn)于此處的過濾器定位不到:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
而IDE卻不會報錯抖甘。
解決方法:
File->ProjectStructure 中進行Fix。
QQ截圖20170409222420.png