【发布时间】:2015-09-02 15:14:13
【问题描述】:
我将我的 Spring 框架从 3.x 迁移到 4.2.RELEASE 但是,当我启动 jUnit 时,我收到了这个错误:
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [file:src/test/resources/applicationContext.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter
我从 4.1 版在互联网上阅读。它不再受支持;我检查并在应用程序类路径上提供了新版本(我导入了 spring-web 依赖项)。 (Spring 4 and Rest WS integration)
看来 spring 还在寻找旧版本的 Converter。这可能取决于我在应用程序上下文中的某些内容,但问题是,我如何“告诉 Spring”使用新版本?
-- 更新
我评论了
<mvc:annotation-driven />
它似乎工作正常,但是......为什么?
【问题讨论】:
-
检查你的类路径,你可能混合了不同的版本,导致行为不稳定。