Dispatcher initialization failed Unable to load configuration.

本文记录了一次使用Struts2框架遇到的初始化失败问题及其解决过程。作者尝试了多个版本的Struts包仍报错,最终通过调整配置文件和移除不必要的插件解决了问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错 Dispatcher initialization failed Unable to load configuration.


昨天试了一下最新的struts包也是报这个错误,今天试下旧版本的struts包2.3.4.1还是报错。就去晚上找解决方案了

现实加载了struts2-spring-plugin,即网上找到的其中一个解决方案,并没有有效的解决这个问题,继续找解决方案



试了好几个方法都不成功,我决定试试重装tomcat并且保持其一级目录不带空格


郁闷了下载了免安装包还是不行,我决定继续找。。。崩溃ing


好吧,看了后台控制器,发现找不到struts2-spring-plugin的配置,果断先移除(前面的坑填了),然后就TOMCAT运行正常了。


总结,我认为是TOMCAT的问题,重新下载个免安装的方便很多


附上jar包及struts.xml,web.xml配置


web.xml(注先看下你下载的struts2版本包内是否包含org.apache.struts2.dispatcher.FilterDispatcher,高级版本的为我之前发的那个filter目录下的excuteand**类,见上文)

<filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>

     <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>



<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name = "struts" extends = "struts-default">
        <action name = "login" class = "action.LoginAction">
        <result name = "success">/welcome.jsp</result>
        <result name = "error">/error.jsp</result>
        </action>
    </package>
</struts>



=============================才发现现在2016年还学着2012年的老东西,而且自己还没能够掌握,惭愧惭愧=====================================

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值