Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts

struts报错信息:
Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts.xml:13:72
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.(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4908)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5602)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase S t a r t C h i l d . c a l l ( C o n t a i n e r B a s e . j a v a : 1572 ) a t o r g . a p a c h e . c a t a l i n a . c o r e . C o n t a i n e r B a s e StartChild.call(ContainerBase.java:1572) at org.apache.catalina.core.ContainerBase StartChild.call(ContainerBase.java:1572)atorg.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1562)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts.xml:13:72
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)
… 14 more
Caused by: Action class [com.atguigu.Product] does not have a public no-arg constructor - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts.xml:13:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:487)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:426)
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)
… 16 more
Caused by: java.lang.NoSuchMethodException: com.atguigu.Product.()
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:476)
… 22 more
错误提示信息,1.无法加载struts.xml某一行,
Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts_第1张图片
(这一行配置没有问题)
2.Action class [com.atguigu.Product] does not have a public no-arg ,action没有构造方法,
3.java.lang.NoSuchMethodException: com.atguigu.Product找不到Product 这个action
综合以上信息,问题应该是出在com.atguigu.Product上了

Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts_第2张图片
原来这个action没有继承ActionSupport,也没有无参构造函数。
修改如下:
Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts_第3张图片
重新启动项目,无异常日志输出,这个是平常不注意的小细节引起的。
Unable to load configuration. - action - file:/D:/Tomcat7.0/wtpwebapps/struts/WEB-INF/classes/struts_第4张图片
项目下载连接 https://download.csdn.net/download/qq_21119773/10960836
如有问题联系抠1913284695

你可能感兴趣的:(java)