Andrunevchyn

Andrunevchyn


November 2016
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
282930  

Categories


Spring: migration from 3.x to 4.x issue

Andriy AndrunevchynAndriy Andrunevchyn

Today we’ve got such exception

org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation

quick investigation on Spring sources led us to issue with json serialization.

We use jackson for converting  from object to json behind the scene

For Spring 3.x we configured

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.4.2</version>
</dependency>

But Spring 4.x requires jackson v2

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.4</version>
</dependency>
 
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.4</version>
</dependency>

Thx to Xavier Padró and his blog for hint

Also you can read more about json serialization in Spring 4.x on Spring official blog

Comments 0
There are currently no comments.