用struts2整合spring,实现了一个登陆,把应该加的组件都加上了,出现了这样的一个错误,
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException
这是什么原因????
web.xml的配置文件:<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <filter>
<filter-name>loginS2S</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>


<filter-mapping>
<filter-name>loginS2S</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
spring,applicationContext.xml配置文件:<bean id="loginService"
class="com.limeng.service.impl.LoginServiceImpl">
</bean>
<bean id="loginAction" class="com.limeng.action.LoginAction"
scope="prototype">
<property name="loginService">
<ref local="loginService" />
</property>
</bean>
struts.xml配置文件内容:<struts>
<constant name="struts.objectFactory" value="spring"> </constant>
<package name="loginS2S" extends="struts-default">
<action name="login" class="loginAction">
<result name="success">/result.jsp</result>
<result name="input">/login.jsp</result>
</action>
</package>
</struts>
架包有:commons-logging.jar,freeer-2-3.x.jar,ognl-2.x.jar,struts2-core.2.x.jar,struts2-spring-plugin-2.x.jar,xwork-2.x.jar,spring.jar
业务逻辑代码很简单,应该不会出错,于是把这些重要的配置文件写出来,为这个问题很着急呀,希望那位高手指点,或者加我QQ号694253034

解决方案 »

  1.   

    java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException 找不到这个类...
      

  2.   


      加人 spring-web.jar 包。你把这个包加进去看还有没有问题,还有问题的话就参照我下面列出的jar 看你有没有少。
     
      我做的 Struts2 整合 Spring  jar 包文件如下:  commons-attributes-api.jar
      commons-attributes-compiler.jar
      log4j-1.2.14.jar
      spring-beans.jar
      spring-context.jar
      spring-core.jar
      spring-web.jar
      commons-logging.jar
      freeer.jar
      ognl.jar
      struts2-core.jar
      struts2-spring-plugin.jar
      xwork.jar