struts2使用Convention Plugin在weblogic上以war包部署時,找不到Action的解決辦法

來源:互聯網
上載者:User

標籤: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的解決辦法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.