`
catlovefox
  • 浏览: 26232 次
  • 性别: Icon_minigender_2
  • 来自: 济南
社区版块
存档分类
最新评论

Context [/XXX(我的项目)] startup failed due to previous errors

    博客分类:
  • JAVA
阅读更多

今天配置Spring来显示flex的项目。
出现了这个错误。
Context [/XXX(我的项目)] startup failed due to previous errors

web.xml中:

<context-param>
      <param-name>contextConfigLocation </param-name>
      <param-value>/WEB-INF/applicationContext.xml </param-value>
</context-param>
<listener>
      <listener-class>
       org.springframework.web.context.ContextLoaderListener 
      </listener-class>
</listener>

----------------------
去掉
<listener>
      <listener-class>
       org.springframework.web.context.ContextLoaderListener 
      </listener-class>
</listener>

就可以不报这个错误,但是,却不能使用spring链接。

-----------------------------------

原来是因为:

org.springframework.web.context.ContextLoaderListener 
是在Servlet2.4容器上才有的.以前版本是没有的.你看看你使用的容器是否是Servlet2.4,不是的话.
以前版本是这样用的.
<servlet>
   <servlet-name>SpringContextServlet </servlet-name>
   <servlet-class>org.springframework.web.context.ContextLoaderServlet </servlet-class>   
   <load-on-startup>1 </load-on-startup>
</servlet>

 

------------------------------

删除<listener>
      <listener-class>
       org.springframework.web.context.ContextLoaderListener 
      </listener-class>
</listener>
用上边的替代,即可。

--------------------------------------

ps:确定

你可能把不要的包也导进去了或是哪个必需的包没导入,以下是必需包:
Spring包(9个): 
commons-dbcp.jar、commons-pool.jar、spring.jar、spring-beans.jar、
spring-context.jar、spring-core.jar、spring-dao.jar、
spring-hibernate3.jar、spring-web.jar
struts2.0包(6个):commons-logging-api-1.1.jar、freemarker-2.3.8.jar 
ognl-2.6.11.jar、struts2-core-2.0.8.jar、
struts2-spring-plugin-2.0.11.2.jar、xwork-2.0.3.jar 
hibernate包:myeclipse工具自动添加生成导入。

 

---------------------

ps2:还要确定,导入jar

在Spring MVC开发的时候,如果从Spring 1.2.x 迁移到Spring 2.0版本的时候,可能会碰到类似于
java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableListableBeanFactory.registerScope(Ljava/lang/String;Lorg/springframework/beans/factory/config/Scope;)V
的错误,原因就在于这两个版本的API发生了变化。
由于Spring API依赖其他的包,比如Jakarta Commons下面的包,所以在版本升级的时候,要同时升级其他依赖的包,特别是版本从1升级到2的情况下,更要小心。
预祝大家Spring开发顺利!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics