【SSH】Dispatcher initialization failed && Exception startingfilter struts2

下午在SSH引入页面过程中,代码照着视频敲完了,显示界面时候一直是这个样子:

然后在Console中查看错误信息如下:

严重: Dispatcher initialization failed

Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/mystruts2_2/WEB-INF/classes/struts.xml:8:68

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)

at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)

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:277)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)

at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)

at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

at java.util.concurrent.FutureTask.run(FutureTask.java:138)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: Action class [com.keshuo.action。LoginVerifyAction] not found - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/mystruts2_2/WEB-INF/classes/struts.xml:8:68

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:409)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)

at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)

... 22 more

2014-9-18 9:00:45 org.apache.catalina.core.StandardContext filterStart

严重: Exception starting filter struts2

Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/mystruts2_2/WEB-INF/classes/struts.xml:8:68

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)

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:277)

at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)

at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)

at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)

at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: Unable to load configuration. - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/mystruts2_2/WEB-INF/classes/struts.xml:8:68

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)

at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)

at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)

... 20 more

Caused by: Action class [com.keshuo.action.LoginVerifyAction] not found - action - file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/webapps/mystruts2_2/WEB-INF/classes/struts.xml:8:68

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:409)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)

at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)

at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)

... 22 more

心想,又要学新东西了。

针对“Exception starting filter struts2”以及“Dispatcher initialization failed”这两个错误,网友们给出的最多的解释就是jar包引入少了:

核对一下这5个基本jar包:

commons-logging-api-1.1.jar

freemarker-2.3.8.jar

ognl-2.6.11.jar

struts2-core-2.0.12.jar

xwork-2.0.6.jar

确实少了一个“commons-logging-api-1.1.jar”,重新生成,问题并没有解决。怎么办?

超哥帮忙一起核对“applicationContext.xml”时候发现,配置Hibernate时候多写了配置文件。

<property name="mappingResources">
	<list>
	<span style="white-space:pre">	</span><value>cn/itcast/shop/user/vo/User.hbm.xml</value>
	</list>

这个“hbm.xml”现在根本就不存在我的工作空间里啊。

除此,在Web.xml当中:

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

在网上看到:如果struts2版本是2.1以前web.xml配置过滤器的时候应该是这样:<filter- class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

如果struts2 版本是2.1以上web.xml配置<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>,虽然我写的是2.1版本的配置语句,可是再次改了一下这里,竟然成功了,也是醉了。

So,一开始遇到的这个问题,两点:

一、基本jar包是否引用充分,基本上网查资料就能够解决。

二、检查Struts.xml和web.xml以及applicationContext.xml三个配置文件中的配置,尤其是

(1)web.xml中的Spring核心监听器:

<!--配置Spring的核心监听器-->
 <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>

 <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
 </context-param>

(2)struts中的核心过滤器

<!--配置Struts2的核心过滤器-->
 <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>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
 </filter-mapping>

考虑struts的版本是否是2.1然后配置<filter-class></filter-class>中的内容。

菜鸟一枚,正在学着怎么飞。

时间: 2024-10-24 13:30:06

【SSH】Dispatcher initialization failed && Exception startingfilter struts2的相关文章

tomcat启动异常(严重: Dispatcher initialization failed Unable to load configuration. - [unknown location] )

严重: Dispatcher initialization failed Unable to load configuration. - [unknown location] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConf

Tomcat启动报错[org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed

Tomcat启动报错: [org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/E:/SoftwareDevelopment/Software/Eclipse4.3/eclipse-jee-kepler-SR1-win32-x86_64/Workspace/.metadata/.plugins/org.ec

严重: Dispatcher initialization failed java.lang.RuntimeException: java.lang.reflect.InvocationT

严重: Dispatcher initialization failed java.lang.RuntimeException: java.lang.reflect.InvocationT (2012-09-23 17:20:13) 转载▼ 标签: struts中jar包 dispatcherinitializa 分类: Struts2 错误提示:严重: Dispatcher initialization failed java.lang.RuntimeException: java.lang.

【LR11】Error -27796: Failed to connect to server"server:port": [10060] Connection timed out错误解决办法

  场景描述:被测系统是发布在远程服务器上的,假设IP是10.10.10.10,端口是8066,那么访问地址是http://10.10.10.10:8066/,在control机器上我设置了IP欺骗. 错误现象:在场景运行时出现大量Action.c(8): Error -27796: Failed to connect to server"server:port": [10060] Connection timed out错误. 官方的troubleshooting: 查看工具的tro

struts报错严重: Dispatcher initialization failed Unable to load configuration.

在使用struts编程时出现下例错误,总结网上解决方法,汇总如下 严重: Dispatcher initialization failed Unable to load configuration. 报上面错误的原因有多种,得看后面提示是什么原因引起的,再动手解决. ***************************************** 情况一: 严重: Dispatcher initialization failed Unable to load configuration. -

Dispatcher initialization failed

015-5-11 16:44:49 com.opensymphony.xwork2.util.logging.commons.CommonsLogger fatal 严重: ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION ********** Looks like the Spring listener was not configured for your web app! Nothing will work until

【SSH】---【Struts2、Hibernate5、Spring4】【散点知识】

一.Struts21.1.Struts2的概念Struts2是一个用来开发MVC应用程序的框架,它提供了Web应用程序开发过程中的一些常见问题的解决方案:    ->对来自用户的输入数据进行合法性验证:?    ->统一的布局:?    ->可扩展性:?    ->国际化和本地化:?    ->支持Ajax?    ->表单的重复提交?    ->文件的上传下载(文件上传中文件的类型不是普通类型,而是多媒体数据类型[*.txt.*.doc.*.xls等],由于表单

【SSH】---【Struts2、Hibernate5、Spring4集成开发】

Struts2.Hibernate5.Spring4集成开发步骤: 一.导入Jar包(基本的大致有41个,根据实际项目的需求自己添加) antlr-2.7.7.jar aopalliance.jar asm-5.1.jar asm-commons-5.1.jar asm-tree-5.1.jar aspectjweaver-1.8.7.jar c3p0-0.9.2.1.jar classmate-1.3.0.jar commons-fileupload-1.3.2.jar commons-io-

【SSH】 之 Struts

(一)什么是Struts,Struts是什么? Struts是学习轻量级J2EE框架所必须要了解的一个框架,也是我们当前最最流行的三大框架(SSH——Struts,Spring,Hibernate)之一.struts是一个开源框架,帮助我们使用mvc设计模式来开发web应用,它通过采用JavaServlet/JSP技术,实现了基于Java EEWeb应用的MVC设计模式的应用框架,是MVC经典设计模式中的一个经典产品.Struts实现的重点在C(Controller),包括ActionServl