當前項目是使用Struts Portlet Framework 5.0的,Struts 是1.1版本。原本打算在RAD 7里面按照向導起一個Struts Portlet項目,然后再把Modules 一個個遷移過去,但是其好項目后一看傻掉了,是Struts 2.0的框架。于是,只好按照下面的步驟一步一步遷移了。
l 在Websphere Portal的安裝目錄下找到installableApps目錄,里面有一個SPFLegacyBlank.war,將它導入到RAD的工作空間中,我們將用其中的文件作為模板。
l 從模板應用程序復制 META-INF/services/org.apache.commons.logging.LogFactory 文件到遷移項目中。
l 將以下 JAR 文件從模板應用程序復制到遷移項目的 WEB-INF/lib 目錄中,如果這些 JAR 文件已經存在,那么覆蓋它們。
u commons-beanutils.jar
u commons-collections.jar
u commons-digester.jar
u commons-fileupload.jar
u commons-lang.jar
u commons-validator.jar
u jakarta-oro.jar
u PortalStruts.jar
u PortalStrutsCommon.jar
u PortalStrutsTags.jar
u struts.jar
u struts-legacy.jar
u StrutsUpdateForPortal.jar
u wp.struts-commons-logging.jar
u wp.struts.tlds.common.jar
l 從遷移項目的 WEB-INF/lib 目錄中刪除以下文件:
u commons-dpcp.jar
u commons-logging.jar
u commons-pool.jar
u commons-resources.jar
u commons-services.jar
u jdbc2_0-stdext.jar
l 刪除遷移項目中的struts TLD文件,并從web.xml中移除這些TLD的引用
u struts-bean.tld
u struts-chtml.tld
u struts-html.tld
u struts-logic.tld
u struts-nested.tld
u struts-portal-html.tld
u struts-portal-wml.tld
u struts-template.tld
u struts-tiles.tld
u struts-wml.tld
l 修改JSP中對Struts, JSTL的URI的約定(非常重要,否則會出現頁面無法顯示的情況)。例如,
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
需要改為
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
l
u http://struts.apache.org/tags-bean
u http://struts.apache.org/tags-chtml
u http://struts.apache.org/tags-html
u http://struts.apache.org/tags-logic
u http://struts.apache.org/tags-nested
u http://portal/struts/tags-html-1.0
u http://portal/struts/tags-wml-1.0
u http://struts.apache.org/tags-template
u http://struts.apache.org/tags-tiles
u http://struts.apache.org/tags-wml-1.0
l 在項目portler.xml中移除
<config-param>
<param-name>FilterChain</param-name>
<param-value>StrutsTranscoding</param-value></config-param>
完成上述步驟以后,移植就算完成了。
另外附加一個Websphere 5.0移植含Web項目的EAR到Websphere 6.0上的一個小帖士,是在部署期間很莫名的一個錯誤:
IWAE0022E Exception occurred loading deployment descriptor for module ‘XXX_Web’ in EAR file XXX_EAR
而在RAD7的Websphere6的測試服務器上部署的時候并未出現這個錯誤,仔細檢查過部署描述文件也沒發現有什么問題。后來,不知算不算運氣好,終于找到原因,原來問題出在Web項目的web.xml,移除其中所有的<Servlet>下的<display-name>后問題得以解決。
參考資料:http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/index.jsp?topic=/com.ibm.wp.ent.doc/wpf/mig_struts.html