<interceptor-ref name="defaultStackz"></interceptor-ref>的问题

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

Java丶宇

2015-12-29 21:28

一直报错

严重: Exception starting filter struts2
Unable to load configuration. - interceptor-ref - file:/C:/Documents%20and%20Settings/Administrator/Workspaces/MyEclipse%20Professional%202014/.metadata/.me_tcat7/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:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: Unable to load configuration. - interceptor-ref - file:/C:/Documents%20and%20Settings/Administrator/Workspaces/MyEclipse%20Professional%202014/.metadata/.me_tcat7/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)
    ... 19 more
Caused by: Unable to find interceptor class referenced by ref-name defaultStackz - interceptor-ref - file:/C:/Documents%20and%20Settings/Administrator/Workspaces/MyEclipse%20Professional%202014/.metadata/.me_tcat7/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)
    ... 21 more

后来没办法把这句话删除了才能运行。这是为啥?

写回答 关注

4回答

  • 一个什么样的人
    2016-04-27 12:51:06

    这段代码是必须的,不然会一直报错!有大神能解释一下吗?

  • 热爱学习的赖疙宝
    2016-03-29 12:06:06

    是老师的坑好吗?传上来的代码。

  • Java丶宇
    2015-12-29 21:45:59

    我好像知道怎么错了。

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

    defaultStack多加了一个z  。

    自己被自己气的没话说。 感谢点进来看的小伙伴们 就当错一个教训吧。大家不要烦这样的错误啊。

  • 产品经理不是经理
    2015-12-29 21:35:28

    Caused by: Unable to find interceptor class referenced by ref-name defaultStackz - interceptor-ref

Struts2拦截器浅析

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

37979 学习 · 118 问题

查看课程

相似问题