struts2不能在eclipse中运行是怎么回事儿?!报这个错Dispatcher initialization failed。。。 十二月 24,
Unable to load configuration. - bean - jar:file:/H:/webWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2_HelloWorld/WEB-INF/lib/struts2-core-2.2.3.1.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273) 展开
你的包没有加载上struts2-core-2.2.3.1.jar!/struts-default.xml
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<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>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
其他应该比较简单了
通过上面看出,struts-default.xml文件中29行有错误。也可能是其他地方导致的,比如你的Struts的过滤器路径是否配置正确。可以先把struts-default.xml文件内容贴出来看一下。