SpringBoot - HttpMessageNotReadableException: JSON ayrıştırma hatası: java.net.SocketTimeoutException

oy
7

Kodum aşağıdaki gibi bir istisna atıyor

JSON parse error: java.net.SocketTimeoutException; nested exception is com.fasterxml.jackson.databind.JsonMappingException: java.net.SocketTimeoutException (through reference chain: java.util.ArrayList[9])
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: java.net.SocketTimeoutException; nested exception is com.fasterxml.jackson.databind.JsonMappingException: java.net.SocketTimeoutException (through reference chain: java.util.ArrayList[9])
        at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:245) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:227) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:204) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:157) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:130) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:127) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) ~[spring-web-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) [spring-webmvc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]

İlkbahar önyükleme sürümüm 2.1.7.RELEASE ve uygulamayı çalıştırmak için gömülü tomcat kullanılır. Ayrıca özelliği ayarladım server.connection-timeout=30s

Neredeyse her yerde arama yapıyorum ve bu sorunun temel nedenini tespit edemedim. Ayrıca bu istisnayı yakalayıp günlükte yazdırıyorum ve yanıtı BAD_REQUEST olarak döndürüyorum.

Bu istisna aralıklı olarak atıyor ve üretim sunucum şu anda CPU ve belleğin% 80'inden fazlasını tüketiyor.

Bu aslında bir POST isteğidir ve istek gövdesi aşağıdaki gibi doğrulanır

    @RequestMapping( value = /save, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
    public SaveDto create( @RequestBody @Valid SaveDto saveDto,
        HttpServletResponse response, HttpServletRequest request )
    {
      //my logic
    }

ve SaveDto'm aşağıdaki gibi

@JsonInclude( JsonInclude.Include.NON_NULL )
public class SaveDto
{
    private String id;
    @Size( min = 1 )
    @Valid
    private List< SaveEntryDto > saveLogEntries;
}

Benim saveEntryDto aşağıdaki gibidir

public class SaveEntryDto implements Comparable<SaveEntryDto> {
    private String id;
    private String idRef;
    private WER wer;
    @Min(0)
    @Max(1440)
    private Integer kjh;
    @Min(0)
    @Max(1440)
    private Integer gfd;
    private String abc;
    private Double def;
    private String ghi;
    private Boolean klm = Boolean.FALSE;
    private Boolean hug;
    private Boolean qwe;
    private Double azx;
    private Double xds;
    private Boolean cvf = Boolean.FALSE;
    private Boolean bgh = Boolean.FALSE;
    private String nmj;
    private Boolean rgh;
    private Boolean jkh;
    private Boolean mkl = Boolean.FALSE;
    private Boolean wed = Boolean.FALSE;
    private Long ftu;
    private XYZ xyzxd;
    private String klp;
    private ABC xxz;
    private Boolean llo;
    private Long iop;
    private Double poi;
    private Boolean uyt = Boolean.FALSE;
    private Boolean rew = Boolean.FALSE;
    private String qsd;
}
Oluştur 27/04/2020 saat 14:36
kaynak kullanıcı
Diğer dillerde...                            

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more