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)