Sunday, October 2, 2016

Troubleshooting - Content type 'application/json;charset=UTF-8' not supported

■ There was no problem when testing on Gradle JettyRun.
But After deployed an application, The following error appeared in the log file.

02 Oct 2016;02:05:58.666 [http-nio-8080-exec-6] ERROR c.a.c.AbstractBaseController.handleException(167) - Exception's trace:
org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:235) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:149) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:127) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at
 ...
 ...

■ How to solve this problem.
Add the jar module into build.gradle as below.

dependencies {
...
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.3'
...
}