每当我启动我的应用程序时,我都会遇到来自spring web context listener的这个问题。 这是异常的完整堆栈跟踪
第一个堆栈跟踪
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring-servlet.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;
在异常的第二行,我得到第二个堆栈跟踪
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:81)
这是我的spring-servlet.xml文件的内容
<!-- Configuration defining views files -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/jsp/</value>
<!-- <value>/</value> -->
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<!-- <tx:annotation-driven /> -->
<!-- <bean id="txManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"></bean> -->
<mvc:resources mapping="/resources/js/**" location="/resources/js/" />
<mvc:resources mapping="/resources/css/**" location="/resources/css/" />
<!-- <aop:config>
<aop:aspect id="myaspect" ref="checkLogin1" >
@Before
<aop:pointcut id="pointCutBefore" expression="execution(* cntrlr.cntrlrUser..*(..))" />
<aop:before method="myadvice" pointcut-ref="pointCutBefore" />
</aop:aspect>
</aop:config> -->
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/jsp/user/**"/>
<bean class="interceptor.CheckLogin" />
</mvc:interceptor>
</mvc:interceptors>
<mvc:annotation-driven />
我的tomcat拒绝启动我的应用程序。请问有什么不对?
答案 0 :(得分:0)
这是我的解决方案
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework-version}</version>
</dependency>