我想将Spring2.0框架整合到一个Struts项目中,在web.xml中添加了如下一个监听器:
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
但是只要一加上上述代码,整个项目就无法启动,tomcat控制台中显示这样的错误信息:
2008-3-22 12:02:03 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2008-3-22 12:02:03 org.apache.catalina.core.StandardContext start
严重: Context [/myproject] startup failed due to previous errors
不加上这个监听器就没问题。我已经在项目中添加了spring.jar包。
各位高手大虾帮帮忙,搞了一天了。Many Thanks.

解决方案 »

  1.   

    可能是JAR包的问题,去掉没用到的包..
      

  2.   

    <listener-class> 
    org.springframework.web.context.ContextLoaderListener 
    </listener-class> 
    指启动服务器的时候 ,初始化 spring 容器 ,所以还要 指定你的配置文件
    再web.xml 文件里面加入
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/DAOContext.xml(根据自己项目)</param-value>
    </context-param>
    spring 和struts 由多种整合方式
      也可以直接再struts 里面配置 <plug-in /> 
      那样 web.xml 就不需要配置
     <listener-class> 和<context-param>  
      

  3.   


    因为在Spring 2.0中有一个包ams.jar 包和它其实指的是一个。