- This topic has 1 reply, 2 voices, and was last updated 7 years, 5 months ago by support-swapna.
-
AuthorPosts
-
eugenejsnParticipantME 2017 Windows 7.
Followed the guide https://www.genuitec.com/spring-frameworkrestcontroller-vs-controller/.
Returned 406 Not Acceptable error.
Spring: 4.1.1.Release
POM.xml
First tried:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.9</version>
</dependency><dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>–Did not work.
Then upgraded to
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>2.8.9</version>
</dependency>web-servlet.xml
<mvc:annotation-driven>
<mvc:message-converters>
<bean class=”org.springframework.http.converter.StringHttpMessageConverter”/>
<bean class=”org.springframework.http.converter.json.MappingJackson2HttpMessageConverter”/>
</mvc:message-converters>
</mvc:annotation-driven>Also tried:
<mvc:annotation-driven />
<bean class=”org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter”>
<property name=”messageConverters”>
<list>
<ref bean=”jacksonMessageConverter”/>
</list>
</property>
</bean>
<bean id=”jacksonMessageConverter” class=”org.springframework.http.converter.json.MappingJackson2HttpMessageConverter”></bean>or
<bean id=”contentNegotiationManager” class=”org.springframework.web.accept.ContentNegotiationManagerFactoryBean”>
<property name=”favorPathExtension” value=”false” />
<property name=”favorParameter” value=”true” />
<property name=”mediaTypes” >
<value>
json=application/json
xml=application/xml
</value>
</property>
</bean>None worked.
Looks like there were mismatching among versions of the JACKSON, Spring, and message-converters. But which version works with which?
Eugene
- This topic was modified 7 years, 5 months ago by eugenejsn.
support-swapnaModeratorEugene,
I am afraid this is a Spring development related query. I suggest you cross post to development related forums like stackoverflow.com for better suggestions from the developer community.
–Swapna
MyEclipse Support -
AuthorPosts