1. 程式人生 > >Struts2.3.15.1升級Struts2.3.32

Struts2.3.15.1升級Struts2.3.32

今天突然看到一篇技術文章,說Struts2又出了新的安全漏洞,我趕緊檢視Struts2版本,正好在漏洞範圍之內,開始了升級之旅,技術文章都建議更新至 Struts 2.3.32 或者 Struts 2.5.10.1 。

我試圖一步直接升級到2.5,結果需要升級的補丁太多,已經放棄。

1、替換了struts2-core-2.3.32.jar包,結果啟動報錯:

log4j:WARN No such property [file] in org.apache.log4j.ConsoleAppender.
08-Mar-2017 13:08:55.603 SEVERE [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
08-Mar-2017 13:08:55.603 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [] startup failed due to previous errors
[2017-03-08 01:08:55,744] Artifact unnamed: Error during artifact deployment. See server log for details.

2、解決出錯問題:檢視完整的報錯日誌。

通過百度配置log4j和loggers.properties 。

由於沒有找到完整的log位置,繼續報錯:this web application instance has been stopped already.  Could not load org.apache.log4j.ConsoleAppe

3、後來發現錯誤日誌檔案被idea監管了,從這裡能找到那些class缺少,從報錯資訊中很方便的能找到struts2.3.32依賴的包。

4、本次替換的所有包:ognl-3.0.19.jar 、 struts2-core-2.3.32.jar、xwork-core-2.3.32.jar、freemarker-2.3.22.jar

5、啟動成功了。