struts2没有spring的情况下加了struts2-spring-plugin-2.3.24.1.jar导致错误

  1. Unable to load configuration. - bean - jar:file:/F:/Documents/MyJava/Spring114/out/artifacts/Spring114_war_exploded/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
  1. Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/F:/Documents/MyJava/Spring114/out/artifacts/Spring114_war_exploded/WEB-INF/lib/struts2-spring-plugin-2.3.24.1.jar!/struts-plugin.xml:29:132
  2. at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)
  3. at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
  4. at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
  5. at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
  6. ... 53 more
  7. Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
如果没有spring的情况下,加入了struts2-spring-plugin,那么就会连接这两者,而这个ApplicationContextAware:

接口(ApplicationContextAware),这个类就可以方便获得ApplicationContext中的所有bean。换句话说,就是这个类可以直接获取spring配置文件中,所有有引用到的bean对象。


解决方法,要么删掉这个jar包,要么加入spring框架...








原文地址:https://www.cnblogs.com/share2015/p/5304536.html