Sunday, July 24, 2016

415 Unsupported Media Type

Hi Guys,

You might face this error while hitting a rest service which consumes request in JSON format.
Developers this might face this error when they are testing a spring based rest service.
Even if you have the dependent jars in place and spring application is successfully deployed you may still face this issue. The solution to this is include the following dependency in your pom.ml if you are using maven project.

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.1</version>
</dependency>

This is actually required when your spring controller is using @RequestBody.Eventhough the spring documentation site mentions this in their site you will not be prompted for a compilation error or runtime error even if you do not include the above dependency.

No comments:

Post a Comment

ec2-user@ec2 Permission denied