I was trying to run a java batch that call an application context without success (it’s a java app that calls a Camel spring context). This is what I get during the startup:
ERROR ApplicationProperties @ addApplicationProperty [28] org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file [/MessageRouting/src/test/resources/META-INF/spring/LOCALHOST-db-context.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter Fatal error! java.lang.RuntimeException: Error loading ClassPathXmlApplicationContext file - src/test/resources/META-INF/spring/LOCALHOST-db-context.xml |
I’m using spring 4.2.3 (updated yesterday, probably the reason for which it doesn’t work. It was 4.0.9). I know that MappingJacksonHttpMessageConverter has been replaced by MappingJackson2HttpMessageConverter but, how can I tell to spring to use the new version???
I followed some suggestion and I added this to my pom.xml:
<dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.6.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.6.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.6.3</version> </dependency> |
But this didn’t fix so, I finally resolved the issue adding this dependency to my pom.xml:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework-version}</version> </dependency> |