项目启动报:com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.

使用struts2实现上传下载的项目,写完后启动项目报:
com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) ~[xwork-core-2.3.30.jar:2.3.30]
	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970) ~[struts2-core-2.3.30.jar:2.3.30]
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438) ~[struts2-core-2.3.30.jar:2.3.30]
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482) [struts2-core-2.3.30.jar:2.3.30]
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) [struts2-core-2.3.30.jar:2.3.30]
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) [struts2-core-2.3.30.jar:2.3.30]
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277) [catalina.jar:7.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258) [catalina.jar:7.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382) [catalina.jar:7.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:103) [catalina.jar:7.0.30]
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650) [catalina.jar:7.0.30]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306) [catalina.jar:7.0.30]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.30]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.30]
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.30]
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) [catalina.jar:7.0.30]
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1100) [catalina.jar:7.0.30]
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1618) [catalina.jar:7.0.30]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [?:1.7.0_76]
	at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_76]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_76]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_76]
	at java.lang.Thread.run(Thread.java:745) [?:1.7.0_76]
Caused by: com.opensymphony.xwork2.config.ConfigurationException: Action class [com.lihf.action] not found
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486) ~[xwork-core-2.3.30.jar:2.3.30]
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429) ~[xwork-core-2.3.30.jar:2.3.30]
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556) ~[xwork-core-2.3.30.jar:2.3.30]
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295) ~[xwork-core-2.3.30.jar:2.3.30]
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) ~[struts2-core-2.3.30.jar:2.3.30]
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264) ~[xwork-core-2.3.30.jar:2.3.30]
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[xwork-core-2.3.30.jar:2.3.30]
	... 22 more
八月 09, 2016 9:34:07 上午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - action - file:/D:/forwork/workspace/.metadata/.me_tcat7/webapps/scxz/WEB-INF/classes/struts.xml:12:50
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:496)
	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.(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:745)
Caused by: Unable to load configuration. - action - file:/D:/forwork/workspace/.metadata/.me_tcat7/webapps/scxz/WEB-INF/classes/struts.xml:12:50
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482)
	... 19 more
Caused by: Action class [com.lihf.action] not found - action - file:/D:/forwork/workspace/.metadata/.me_tcat7/webapps/scxz/WEB-INF/classes/struts.xml:12:50
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:486)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:429)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:556)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:295)
	at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:264)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
	... 22 more
原因是我在编写struts.xml的时候少写了action的名字正确写法应该是:

希望对你们有帮助!


你可能感兴趣的:(Java基础,struts,struts2.0)