简体   繁体   English

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

[英]"The Struts dispatcher cannot be found" error while deploying application on WebLogic 12.1.3

I have the following error while trying to run my application on WebLogic 12.1.3.尝试在 WebLogic 12.1.3 上运行我的应用程序时出现以下错误。

The Struts dispatcher cannot be found.找不到 Struts 调度程序。 This is usually caused by using Struts tags without the associated filter.这通常是由于使用没有关联过滤器的 Struts 标签造成的。 Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. Struts 标签仅在请求通过其 servlet 过滤器时可用,该过滤器初始化此标签所需的 Struts 调度程序。

This is my web.xml file :这是我的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>

If you are using Struts tags inside JSP page that has listed in the welcome-file-list it should be removed.如果您在welcome-file-list列出的 JSP 页面中使用 Struts 标记,则应将其删除。

welcome-file-list in web.xml : web.xml welcome-file-list

The welcome-file-list element of web-app , is used to define a list of welcome files. web-appwelcome-file-list元素用于定义欢迎文件列表。 Its sub element is welcome-file that is used to define the welcome file.它的子元素是welcome-file ,用于定义欢迎文件。

A welcome file is the file that is invoked automatically by the server, if you don't specify any file name.欢迎文件是服务器自动调用的文件,如果您不指定任何文件名。

And hence without associated filter.因此没有关联的过滤器。 The associated filter is defined struts2 mapped to /* .关联的过滤器定义为struts2映射到/* It means it should serve all requests, unless the welcome file is served by the web server.这意味着它应该为所有请求提供服务,除非欢迎文件由 Web 服务器提供。

Normally, you should not directly access JSP pages without prior action execution, that returns a dispatcher ' type result.通常,您不应该在没有事先执行操作的情况下直接访问 JSP 页面,这会返回dispatcher类型的结果。 In this result you can specify the location of the JSP file you want to get the access.在此结果中,您可以指定要访问的 JSP 文件的位置。

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

You are using Struts tags inside a JSP, probably您可能在 JSP 中使用 Struts 标签

/jsp/ao/ApplicationStartUp.jsp

but it has been called without passing through an Action.但它没有通过一个动作就被调用了。

Either pass through an Action, or remove Struts tags from JSP called directly.要么传递一个 Action,要么从直接调用的 JSP 中删除 Struts 标记。

For a welcome file, I'd go with the latter.对于欢迎文件,我会选择后者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM