今天在做struts和Spring框架整合的时候当我把项目部署到tomcat服务器上之后控制台报了一个错误:
Caused by: Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
... 19 more
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:391)
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:362)
at org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java:288)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 21 more
当然,问题的解决是在第二个提示信息:
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
出现问题的原因是:
缺少struts2-spring-plugin-2.1.8.1.jar,该文件是Spring与struts整合时必须要用到的一个jar文件!导入lib文件夹下问题解决了!