加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 在WebLogic 12.1.3上部署应用程序时出现“无法找到Strut

发布时间:2020-12-15 07:37:31 所属栏目:Java 来源:网络整理
导读:尝试在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 se
尝试在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标记,则应将其删除.

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页面,这会返回调度程序的类型结果.在此结果中,您可以指定要获取访问权限的JSP文件的位置.

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读