HTTP Status 406 - Not Acceptable

There are three servers, all of which have the same application installed . There is a request that returns json. On two of the three servers, the request is processed and returns json, and on the third, the request goes into processing, but does not return json, but only this: HTTP Status 406 - Not Acceptable

Type Status report

MessageNot Acceptable

DescriptionThe resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.

The dependencies for json are connected correctly (otherwise, how can I explain that everything goes fine on two servers). What could be the reason?

I turned on the TRACE logging level and found this example:

TRACE - Method [json] returned []

TRACE - Error handling return value [type=org.springframework.http.ResponseEntity] [value=] Controller [com.stm.secure.controller.LoginController]

Method [public org.springframework.http.ResponseEntity com.stm.secure.controller.LoginController.json()] org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:260)

Spring, GlassFish server 4

Author: Денис Кезин, 2017-01-14

1 answers

It was still decided - for some reason, there was no dependency in the new deployments jackson. core with artifactId:jackson-databind. Removed dependencies, reconfigured pom.xml, added them and reconfigured them again. I ran into it when I wanted to replace the standard Jackson2HttpMessageConverter with a custom one https://dzone.com/articles/customizing - an error has surfaced that it is not possible to import the com class.fasterxml.jackson.databind.ObjectMapper;

 0
Author: Денис Кезин, 2017-01-15 12:23:09