首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在WebLogic 12.1.3上部署应用程序时出现“找不到Struts dispatcher”错误

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

Stack Overflow用户
提问于 2015-07-10 09:06:48
回答 2查看 2.9K关注 0票数 1

在WebLogic 12.1.3上运行我的应用程序时,我有以下错误。

找不到Struts调度程序。这通常是由于在不使用相关过滤器的情况下使用Struts标记造成的。Struts标记只有在请求通过其servlet过滤器时才可用,servlet过滤器初始化此标记所需的Struts dispatcher。

这是我的web.xml文件:

代码语言:javascript
复制
<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>

​

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-07-10 09:47:41

如果在welcome-file-list中列出的JSP页面中使用Struts标记,则应该删除它。

web.xml

welcome-file-list元素web-app用于定义欢迎文件列表。它的子元素是welcome-file,用于定义欢迎文件。 如果不指定任何文件名,则欢迎文件是由服务器自动调用的文件。

因此没有关联的过滤器。关联过滤器被定义为struts2映射到/*。这意味着它应该为所有请求服务,除非欢迎文件由web服务器提供。

通常,如果没有预先执行操作,就不应该直接访问JSP页面,这会返回dispatcher的类型结果。在这个结果中,您可以指定要访问的JSP文件的位置。

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

票数 2
EN

Stack Overflow用户

发布于 2015-07-10 09:13:16

您在JSP中使用Struts标记,可能

代码语言:javascript
复制
/jsp/ao/ApplicationStartUp.jsp

但它是在没有经过行动的情况下被调用的。

要么通过一个Action,要么从直接调用的JSP中删除Struts标记。

对于一个受欢迎的文件,我会和后者一起去。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31336754

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档