[英]"The Struts dispatcher cannot be found" error while deploying application on WebLogic 12.1.3
嘗試在 WebLogic 12.1.3 上運行我的應用程序時出現以下錯誤。
找不到 Struts 調度程序。 這通常是由於使用沒有關聯過濾器的 Struts 標簽造成的。 Struts 標簽僅在請求通過其 servlet 過濾器時可用,該過濾器初始化此標簽所需的 Struts 調度程序。
這是我的web.xml
文件:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>SybUI</display-name>
<!-- location of log4j config file -->
<!-- <context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j2.xml</param-value>
</context-param> -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<!-- <filter>
<filter-name>SessionFilter</filter-name>
<filter-class>com.syb.core.filter.SessionFilter</filter-class>
<init-param>
<param-name>avoid-urls</param-name>
<param-value>/timeOut,/pages/timeOut.jsp,/test,/pages/test.jsp,/testMsg.action,/pages/invalidToken.jsp,/login.jsp,/logoutUser,/loginUser.action,
/common/postloginheader.html,/js/jquery.mobile.custom.min.js,/images/plus_cyn_40.png,/js/custom.js,/css/bootstrap.min.css,/css/aos-style.css,
/css/style.css,/js/bootstrap.min.js,/js/modernizr.min.js,/css/custom.css,/js/jquery.validate.min.js,/js/respond.min.js,/js/session1.js,/js/aos-custom.js,
/images/wres009899.png,/images/fdic.png,/images/header_1024.jpg,/images/blue-arrow.png
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SessionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>-->
<!--<session-config>
<session-timeout>10</session-timeout>
</session-config> -->
<welcome-file-list>
<welcome-file>/jsp/ao/ApplicationStartUp.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/jsp/common/error/Error-PageNotFound.jsp</location>
</error-page>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/jsp/common/error/Error-PageNotFound.jsp</location>
</error-page>
如果您在welcome-file-list
列出的 JSP 頁面中使用 Struts 標記,則應將其刪除。
web.xml
welcome-file-list
:
web-app
的welcome-file-list
元素用於定義歡迎文件列表。 它的子元素是welcome-file
,用於定義歡迎文件。歡迎文件是服務器自動調用的文件,如果您不指定任何文件名。
因此沒有關聯的過濾器。 關聯的過濾器定義為struts2
映射到/*
。 這意味着它應該為所有請求提供服務,除非歡迎文件由 Web 服務器提供。
通常,您不應該在沒有事先執行操作的情況下直接訪問 JSP 頁面,這會返回dispatcher
類型的結果。 在此結果中,您可以指定要訪問的 JSP 文件的位置。
如果您導航到 Web 內容層次結構的文件夾,則welcome-file-list
文件由 Web 容器處理,例如如果您沒有在 URL 中使用.action
擴展名,並且其中有一個welcome-file
,並且沒有映射到該 URL 的操作。 在這種情況下,您不能在welcome-file
使用 struts 標簽,因為您試圖在沒有關聯過濾器的情況下運行它,或者 struts2 過濾器已經處理了另一個請求。
您可能在 JSP 中使用 Struts 標簽
/jsp/ao/ApplicationStartUp.jsp
但它沒有通過一個動作就被調用了。
要么傳遞一個 Action,要么從直接調用的 JSP 中刪除 Struts 標記。
對於歡迎文件,我會選擇后者。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.