您的位置:首页 > 移动开发

Spring:Looks like the Spring listener was not configured for your web app!

2017-08-01 21:43 447 查看
1.Spring整合Struts2:配置文件问题

在Spring整合Struts2时出现的一个问题,其实Log的前几句已经告诉我们错误的原因了,因为忘记在web.xml配置文件中没有配置Spring Listener,当我们配置了ConextLoaderListener后,该监听器会在创建时自动查找WEB-INF/路径下applicationContext.xml文件,所以除了配置该ConextLoaderListener,我们还需要将applicationContext.xml放在WEB-INF下

异常如下:

Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.


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


com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Dispatcher initialization failed

java.lang.NullPointerException at
com.opensymphony.xwork2.spring.SpringObjectFactory.
getClassInstance(SpringObjectFactory.java:209) at
com.opensymphony.xwork2.config.providers.
XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring struts2.0
相关文章推荐