sping框架jar包缺失而引起的常见错误

来源:互联网 发布:北塔软件联系人 编辑:程序博客网 时间:2024/05/01 19:25

开始,单加入spring-core.jar,配置web.xml

 <!-- ××××××××××××××× Spring配置和监听 Start ××××××××××××××× -->
 <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/classes/application*.xml</param-value>
 </context-param>
 <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 <!-- ×××××××××××××××× Spring配置和监听 End ×××××××××××××××× -->

 

运行——

严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

 

解决——

缺少org.springframework.web.*,加入spring-web.jar

 

 

运行——

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextException

 

解决——

缺少org.springframework.context.*,加入spring-context.jar

 

 

运行——

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/beans/FatalBeanException
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.FatalBeanException

 

解决——

缺少org.springframework.beans.*,加入spring-beans.jar

 

 

运行——

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

 

解决——缺少org.apache.commons.logging.*,加入commons-logging.jar

 

 

 

struts.xml加入<constant name="struts.objectFactory" value="spring" />


运行——
2010-3-3 20:53:35 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
......
2010-3-3 20:53:35 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - [unknown location]
......
Caused by: Unable to load configuration. - [unknown location]
......
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
......

 

解决——找不到ObjectFactory,加入struts2-spring-plugin-2.1.8.1.jar

0 0
原创粉丝点击