struts2 错误信息

问题1:我将struts2和xwork2的源码都放入workspace,然后运行struts2-blank这个struts的自带demo,tomcat启动时出现这个错误,看起来像是默认就去初始化spring的context,详细stackTrace如下:

  1. 1. ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********   
  2. Looks like the Spring listener was not configured for your web app!    
  3. Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.   
  4. You might need to add the following to web.xml:    
  5.     <listener>   
  6.         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>   
  7.     </listener>   
  8. 2007-9-4 13:13:00 org.apache.catalina.core.StandardContext start   
  9. 严重: Error filterStart   

解决:

web.xml 部分代码增加
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

然后在WebRoot>WEB-INF>下加一个空的applicationContext.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="autodetect">
</beans>
问题2:如何导入源代码?
解决:把源代码拷进去,去掉struts2-core-2.0.11.jar里面org目录下的文件,但保留所有的配置文件,即可。但需要保证web容器里没有其他的项目用到了struts2-core-2.0.11.jar这个文件,否则会报struts2-core-2.0.11.jar里面的配置文件出错。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值