Struts Spring com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1  <—初学Spring整合Struts2时遇到的问题—>

情况:1、由于前边跟着教学视频写,后来介绍另一种写法时。就出现了异常。

解决方案:Struts Spring com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1 的一点解决办法


1、前边跟视频的时候,一号位是写自己自定义的类名。后来上网查了下就改成了上面的写法:

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

原因:是因为非自定义整合时,即使用struts2的基础包时需要调用到ContextLoaderListener。


2、二号位的问题,我弄了好久才发现是自己把 contextConfigLocation 这个名字给改了Struts Spring com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1 的一点解决办法,后来改过来,就能正常运行了。

后来想了下,个人觉得可能是struts2的基础包中的类需要调用 contextConfigLocation 来创建IoC容器,而我把它改掉后,使得程序出错。


本人是个java初学者,以上是在学习过程中遇到的问题。个人得到的教训就是:以后写代码不再马虎了......


其他更详细的解决方案地址:http://javeye.iteye.com/blog/940122/


相关文章:

  • 2021-12-18
  • 2022-12-23
  • 2021-07-01
  • 2021-04-01
  • 2021-04-15
  • 2022-12-23
  • 2021-06-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
相关资源
相似解决方案