標籤:style blog http color io os 使用 ar 檔案
環境: struts 2.3.16.3 + Convention Plugin 2.3.16.3 實現零配置
現象:以檔案夾方式部署在weblogic(10.3.3)上時一切正常,換成war包部署,運行時提示找不到Action
解決辦法:
1. 檢查產生的war包中\WEB-INF\classes\下有無META-INF目錄,如果沒有,在eclipse裡resource\META-INF下隨便放一個檔案,比如test.xml,這樣maven打包產生war包時,才會在classes下建立META-INF目錄
2.struts.xml中增加二個常量
<constant name="struts.convention.action.fileProtocols" value="jar,zip" /> <constant name="struts.convention.action.includeJars" value=".*?/_wl_cls_gen.*?jar(!/)?" />
註:如果要weblogic/jboss通殺的話,可以再加一個常量 ,即共增加3個常量
1 <constant name="struts.convention.action.includeJars" value=".*?/_wl_cls_gen.*?jar(!/)?" /> 2 <constant name="struts.convention.exclude.parentClassLoader" value="true" />3 <constant name="struts.convention.action.fileProtocols" value="jar,zip,vfsfile,vfszip" />
樣本:struts-spring-rest.zip
struts2使用Convention Plugin在weblogic上以war包部署時,找不到Action的解決辦法