“找不到 Struts 调度程序"在 WebLogic 12.1.3 上部署应用程序时出错

quot;The Struts dispatcher cannot be foundquot; error while deploying application on WebLogic 12.1.3(“找不到 Struts 调度程序在 WebLogic 12.1.3 上部署应用程序时出错)

本文介绍了“找不到 Struts 调度程序"在 WebLogic 12.1.3 上部署应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在 WebLogic 12.1.3 上运行我的应用程序时出现以下错误.

I have the following error while trying to run my application on WebLogic 12.1.3.

找不到 Struts 调度程序.这通常是由于使用没有关联过滤器的 Struts 标签造成的.Struts 标签仅在请求通过其 servlet 过滤器时可用,该过滤器会初始化此标签所需的 Struts 调度程序.

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>

推荐答案

如果您在 welcome-file-list 中列出的 JSP 页面中使用 Struts 标记,则应将其删除.

If you are using Struts tags inside JSP page that has listed in the welcome-file-list it should be removed.

web-appwelcome-file-list 元素用于定义欢迎文件列表.它的子元素是welcome-file,用于定义欢迎文件.

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 服务器提供.

And hence without associated filter. The associated filter is defined struts2 mapped to /*. It means it should serve all requests, unless the welcome file is served by the web server.

通常,您不应该在没有事先执行操作的情况下直接访问 JSP 页面,这会返回 dispatcher' 类型的结果.在此结果中,您可以指定要访问的 JSP 文件的位置.

Normally, you should not directly access JSP pages without prior action execution, that returns a dispatcher' type result. In this result you can specify the location of the JSP file you want to get the access.

welcome-file-list 文件由 web 容器处理,如果您导航到 web 内容层次结构的文件夹,例如如果您不使用 .action 扩展名,其中有一个 welcome-file ,并且没有映射到该 URL 的操作.在这种情况下,您不能在 welcome-file 中使用 struts 标签,因为您试图在没有关联过滤器的情况下运行它,或者 struts2 过滤器已经处理了另一个请求.

The welcome-file-list files are handled by the web container if you navigate to the folder of your web content hierarchy, such as if you aren't using the .action extension in the URL, and there's a welcome-file inside it, and there's no action mapped to that URL. In this case you cannot use struts tags inside the welcome-file because you are trying to run it without associated filter, or the struts2 filter is already handled another request.

这篇关于“找不到 Struts 调度程序"在 WebLogic 12.1.3 上部署应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:“找不到 Struts 调度程序"在 WebLogic 12.1.3 上部署应用程序时出错

基础教程推荐