spring 和struts整合过程遇到的一些错误

Spring配置遇到的一些错误

错误:
>
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext

原因:spring初始化bean对象出错,id重复

IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml];
原因:如果不特意指定参数名为contextConfigLoction的元素,那么spring的ContextLoderListener监听器就会在/WEB-INF/下去寻找并加载该目录下的名为applicationContext.xml这个文件
解决:在web.xml中添加标签并再次指定spring核心文件的位置。

<context-param>  
<param-name>contextConfigLocation</param-name>  
<param-value>classpath:applicationContext.xml</param-value>  
</context-param>  

structs2配置

错误:

java.lang.ClassNotFoundException: org.apache.structs2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
解决:2.1.3版本以前用org.apache.struts2.dispatcher.FilterDispatcher
2.1.3版本以后用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

spring和struts2整合

Action class [categoryAction] not found - action - file:/D:/myeclipse2014_workspace/.metadata/.me_tcat7/webapps/ssh/WEB-INF/classes/struts.xml:11:68
解决:导包 struts2-spring-plugin-2.3.4.jar

There is no Action mapped for namespace [/] and action name [listCategory] associated with context path [/ssh]. - [unknown location]
解决:配置文件和jar包问题,找不到action

myeclipse中复制的web项目在部署到tomcat中时会部署之前的项目
解决:右键点击复制的web项目→properties→Myeclipse→project Facets→web→web context-root中输入复制后的项目名重新部署就好了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值