Home  >  Forum  >  Spring
Post New Query

IllegalStateException: Could not instantiate XmlMapper - not found on classpath


joined on
January 20,2015
Asked on October 04,2015
I am creating spring content negotiation application and using MappingJackson2XmlView class. While running URL with .xml, I am getting following error.

Caused by: java.lang.IllegalStateException: Could not instantiate XmlMapper - not found on classpath
at org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.build(Jackson2ObjectMapperBuilder.java:517)
at org.springframework.web.servlet.view.xml.MappingJackson2XmlView.<init>(MappingJackson2XmlView.java:58)
at com.mycompany.config.AppConfiguration.configureViewResolvers(AppConfiguration.java:17)
at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.configureViewResolvers(WebMvcConfigurerComposite.java:126)
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.configureViewResolvers(DelegatingWebMvcConfiguration.java:82)
at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.mvcViewResolver(WebMvcConfigurationSupport.java:820)
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$d75efaf5.CGLIB$mvcViewResolver$35(<generated>)
at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$d75efaf5$$FastClassBySpringCGLIB$$f8085515.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)

joined on
November 18,2013
Replied on October 04,2015

You need jackson-dataformat-xml

For Gradle, use 

compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.6.2'

For maven, use

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.6.2</version>
</dependency>

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us