把老师的代码载了下来,但是启动TomCat时出现配置文件无法载入的情况是什么回事啊?

来源:3-3 [Struts2] 统计Action调用时间案例实现

liezh

2016-08-31 16:40

严重: Exception starting filter struts2

Unable to load configuration. - interceptor-ref - file:/D:/JAVA/TomCat7/webapps/struts-timerInterceptor/WEB-INF/classes/struts.xml:19:42

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

at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)

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

Caused by: Unable to load configuration. - interceptor-ref - file:/D:/JAVA/TomCat7/webapps/struts-timerInterceptor/WEB-INF/classes/struts.xml:19:42

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

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

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

... 20 more

Caused by: Unable to find interceptor class referenced by ref-name defaultStackz - interceptor-ref - file:/D:/JAVA/TomCat7/webapps/struts-timerInterceptor/WEB-INF/classes/struts.xml:19:42

at com.opensymphony.xwork2.config.providers.InterceptorBuilder.constructInterceptorReference(InterceptorBuilder.java:63)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.lookupInterceptorReference(XmlConfigurationProvider.java:1110)

at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildInterceptorList(XmlConfigurationProvider.java:626)

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

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

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

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

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

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

... 22 more

而且无法登陆jsp页面,报404异常

把拦截器注释掉就不会报错,登录JSP页面正常

这是什么回事啊?????


写回答 关注

2回答

  • 慕侠8182069
    2016-11-14 09:44:18

    <interceptor-ref name="defaultStack"></interceptor-ref>

    l老师的这句话写错了

    i丶尘影

    defaultStack后多加了个z,删掉完美运行,谢谢楼楼

    2016-12-14 19:49:41

    共 1 条回复 >

  • liezh
    2016-08-31 17:21:35

    主要是在struts.xml当中手动添加默认拦截器的语句写错了

Struts2拦截器浅析

本视频教程将代领大家了解Struts2拦截器的工作原理及配置

37980 学习 · 118 问题

查看课程

相似问题