关于struts2demo无法启动的奇怪问题
该demo来自慕课网,传送门
报错信息如下:
三月 29, 2016 1:22:38 上午 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\WorkTools\MyEclipse\binary\com.sun.java.jdk7.win32.x86_64_1.7.0.u45\bin;F:\WorkTools\MyEclipse\plugins\com.genuitec.eclipse.server.embedded.tomcat.core_13.0.0.me201503191638\tomcat70\bin
三月 29, 2016 1:22:39 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8080"]
三月 29, 2016 1:22:39 上午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-bio-8009"]
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 479 ms
三月 29, 2016 1:22:39 上午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
三月 29, 2016 1:22:39 上午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.56
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\docs
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\docs has finished in 332 ms
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\examples
三月 29, 2016 1:22:39 上午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
三月 29, 2016 1:22:39 上午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
三月 29, 2016 1:22:39 上午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@70509f13')
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\examples has finished in 310 ms
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\host-manager
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\host-manager has finished in 47 ms
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\manager
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\manager has finished in 49 ms
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\ROOT
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\ROOT has finished in 53 ms
三月 29, 2016 1:22:39 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\struts-timerInterceptor
log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
三月 29, 2016 1:22:40 上午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - interceptor-ref - file:/G:/Deployment/MyEclipse2015/.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:279)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4830)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5510)
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:649)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1897)
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:/G:/Deployment/MyEclipse2015/.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)
... 18 more
Caused by: Unable to find interceptor class referenced by ref-name defaultStackz - interceptor-ref - file:/G:/Deployment/MyEclipse2015/.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)
... 20 more
三月 29, 2016 1:22:40 上午 org.apache.catalina.core.StandardContext startInternal
严重: Error filterStart
三月 29, 2016 1:22:40 上午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/struts-timerInterceptor] startup failed due to previous errors
三月 29, 2016 1:22:40 上午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory G:\Deployment\MyEclipse2015\.metadata\.me_tcat7\webapps\struts-timerInterceptor has finished in 905 ms
三月 29, 2016 1:22:40 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
三月 29, 2016 1:22:40 上午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
三月 29, 2016 1:22:40 上午 org.apache.catalina.startup.Catalina start
信息: Server startup in 1736 ms
我想错误应该是指struts.xml的第19行吧?附上其的代码:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="/" extends="struts-default">
<!-- 注册拦截器 -->
<interceptors>
<interceptor name="mytimer" class="com.imooc.interceptor.TimerInterceptor"/>
</interceptors>
<action name="timer" class="com.imooc.action.TimerAction">
<result>/success.jsp</result>
<!-- 为Action显示引用拦截器后,默认的拦截器defaultStack不再生效,需要手工引用 -->
<interceptor-ref name="defaultStackz"></interceptor-ref><!--这是第19行 -->
<!-- 引用拦截器 -->
<interceptor-ref name="mytimer"/>
</action>
</package>
</struts>
求救啊各位大神T0T。
会不会和环境有关?我用的是jdk1.8和tomcat8
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你默认拦截器的名字写错了吧?你看你的报错信息:Caused by: Unable to find interceptor class referenced by ref-name defaultStackz -,应该是defaultStack
找不到19行拦截器对应的类,你看你类名是不是写错了