"The Struts dispatcher cannot be found" 在 WebLogic 12.1.3 上部署应用程序时出错
"The Struts dispatcher cannot be found" error while deploying application on WebLogic 12.1.3
我在 WebLogic 12.1.3 上尝试 运行 我的应用程序时遇到以下错误。
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag.
这是我的 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>
您正在 JSP 中使用 Struts 标签,可能
/jsp/ao/ApplicationStartUp.jsp
但是没有通过Action就被调用了。
要么通过一个动作,要么从直接调用的 JSP 中删除 Struts 标签。
对于欢迎文件,我会选择后者。
如果您在 JSP 页面中使用 Struts 标签,并且已在 welcome-file-list
中列出,则应将其删除。
welcome-file-list
in web.xml
:
The welcome-file-list
element of web-app
, is used to define a list of welcome files. Its sub element is welcome-file
that is used to define the welcome file.
A welcome file is the file that is invoked automatically by the server, if you don't specify any file name.
因此没有关联的过滤器。关联的过滤器定义为 struts2
映射到 /*
。这意味着它应该为所有请求提供服务,除非 Web 服务器提供欢迎文件。
通常情况下,您不应该在没有事先执行操作的情况下直接访问 JSP 页面,即 returns 一个 dispatcher
' 类型的结果。在此结果中,您可以指定要获得访问权限的 JSP 文件的位置。
如果您导航到 Web 内容层次结构的文件夹,例如如果您没有在 [=42] 中使用 .action
扩展,则 welcome-file-list
文件由 Web 容器处理=],其中有一个 welcome-file
,并且没有映射到 URL 的操作。在这种情况下,你不能在 welcome-file
中使用 struts 标签,因为你试图在没有关联过滤器的情况下 运行 它,或者 struts2 过滤器已经处理了另一个请求。
我在 WebLogic 12.1.3 上尝试 运行 我的应用程序时遇到以下错误。
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag.
这是我的 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>
您正在 JSP 中使用 Struts 标签,可能
/jsp/ao/ApplicationStartUp.jsp
但是没有通过Action就被调用了。
要么通过一个动作,要么从直接调用的 JSP 中删除 Struts 标签。
对于欢迎文件,我会选择后者。
如果您在 JSP 页面中使用 Struts 标签,并且已在 welcome-file-list
中列出,则应将其删除。
welcome-file-list
in web.xml
:
The
welcome-file-list
element ofweb-app
, is used to define a list of welcome files. Its sub element iswelcome-file
that is used to define the welcome file.A welcome file is the file that is invoked automatically by the server, if you don't specify any file name.
因此没有关联的过滤器。关联的过滤器定义为 struts2
映射到 /*
。这意味着它应该为所有请求提供服务,除非 Web 服务器提供欢迎文件。
通常情况下,您不应该在没有事先执行操作的情况下直接访问 JSP 页面,即 returns 一个 dispatcher
' 类型的结果。在此结果中,您可以指定要获得访问权限的 JSP 文件的位置。
如果您导航到 Web 内容层次结构的文件夹,例如如果您没有在 [=42] 中使用 .action
扩展,则 welcome-file-list
文件由 Web 容器处理=],其中有一个 welcome-file
,并且没有映射到 URL 的操作。在这种情况下,你不能在 welcome-file
中使用 struts 标签,因为你试图在没有关联过滤器的情况下 运行 它,或者 struts2 过滤器已经处理了另一个请求。