【发布时间】:2016-10-17 18:11:42
【问题描述】:
每当我启动我的应用程序时,我都会从 Spring Web 上下文侦听器中遇到这个问题。 这是异常的完整堆栈跟踪
第一个堆栈跟踪
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 拒绝启动我的应用程序。请问有什么问题吗?
【问题讨论】:
-
能否请您分享整个配置..我怀疑有些东西有重复条目
-
您正在混合不同版本的 spring jars。
-
请不要找你。它发生在哪里
-
如果有的话,能给我们看看你的 pom.xml 吗?或者您使用其他任何东西来管理您的构建?
标签: java xml spring spring-mvc