struts2.2.3升級到2.3.15.3過程記錄

如下按照步驟,依次介紹。 java

1.jar包替換。共包括一下幾個。 web

commons-lang3-3.1.jar
ognl-3.0.6.jar
struts2-convention-plugin-2.3.15.3.jar
struts2-core-2.3.15.3.jar
struts2-json-plugin-2.3.15.3.jar
xwork-core-2.3.15.3.jar
express

2.以後工程內編譯報錯。主要是新版中的api有變動。 apache

struts中校驗的一個屬性原名爲expression,新版爲regexExpression。所有修改。 json

3.還有一個錯誤老是修改很差。以前的版本中沒有Date類型的校驗,工程本身實現,繼承了xwork的DateRangeFieldValidator。 api

如今編譯報錯,就只是把錯誤修正,啓動報錯。 socket

後來發如今新的xwork中已有相似實現,舊的文件刪掉,配置信息刪掉。 測試

4.緊接着有報錯,主要錯誤信息有 spa

[webserver][ERROR][2013-10-25 17:18:06][main][c.o.x.u.l.c.CommonsLogger.error(line:38)]:> Actual exception
com.opensymphony.xwork2.config.ConfigurationException: Caught Exception while registering Interceptor class org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor
.net


Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.6.0_20]

搜索良久後才找到緣由,配置文件的文件聲明須要修改。修改以後:

struts.xml

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">


validators.xml

<!DOCTYPE validators PUBLIC
        "-//Apache Struts//XWork Validator Config 1.0//EN"
        "http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">


5.啓動後,控制檯提示 >>> ActionContextCleanUp <<< is deprecated! Please use the new filters!

原來是新版中web.xml配置的ActionContextCleanUp不建議使用了,刪掉。

至此,主要問題已經解決,程序啓動正常。再測試一下。

注:

1.後臺有一堆報錯信息,正在找方法解決。還好報錯不影響程序運行。

相關文章
相關標籤/搜索