Ошибка ввода / вывода при чтении входного сообщения; вложенный java .io.IOException - PullRequest
0 голосов
/ 13 апреля 2020

Я получаю эту ошибку при отправке почтового запроса для создания пользователя ... Пользователь создан и ответ верен правильно ... но я получаю эту ошибку после него ...

{"firstName": "Hussam", "lastName": "Elmaghraby", "email": "hoyquhhu22wddwsadsssssskcq@yahoo.com"} {"timestamp": "2020-04-13T16: 50: 46.090 + 0000", "status": 200, "error" : "OK", "message": "Ошибка ввода-вывода при чтении входного сообщения; вложенное исключение: java .io.IOException: Поток закрыт", "trace": "org.springframework.http.converter.HttpMessageNotReadableException: I Ошибка / O при чтении входного сообщения; вложенное исключение: java .io.IOException: поток закрыт \ r \ n \ tat org.springframework.web.servlet. mvc .method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters (AbstractMessolConververment 1014 *: 217) \ r \ n \ tat org.springframework.web.servlet. mvc .method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters (RequestResponseBodyMethodProcessor. java: 158) \ r. .web.servlet. mvc .method.annotation.RequestResponseBodyMethodProcessor.resolveArgument (RequestResponseBodyMethodProcessor. java: 131) \ r \ n \ tat org.springframework.web.method. : 121) \ r \ n \ tat org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues ​​(InvocableHandlerMethod. java: 167) \ r \ n \ tat org.springframework.web.ortin (InvocableHandlerMethod. java: 134). .springframework.web.servlet. mvc .method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (RequestMappingHandlerAdapter. java: 879) \ r \ n \ tat org.springframework.web.servno. .handleInternal (RequestMappingHandlerAdapter java:. 793) \ г \ n \ tat org.springframework.web.servlet. mvc .method.AbstractHandlerMethodAdapter.handle (AbstractHandlerMethodAdapter. java: 87) \ r \ n \ tat org.springframework.web.servlet.DispatcherServlet. 1030 *: 1040) \ r \ n \ tat org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet. java: 943) \ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.processReerest . java: 1006) \ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.doPost (FrameworkServlet. java: 909) \ r \ n \ tat javax.servlet.http.HttpServlet.service (HttpServlet . java: 660) \ r \ n \ tat org.springframework.web.servlet.FrameworkServlet.service (FrameworkServlet. java: 883) \ r \ n \ tat javax.servlet.http.HttpServlet.service (HttpServlet . java: 741) \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 231) \ r \ n \ tat org. apache .catalina.core .ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) \ r \ n \ tat org.springframework.securit y.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. java: 320) \ r \ n \ tat com.flightreservation.security.AuthorizationFilter.doFilterInternal (AuthorizationFilter. java: 35) \ r \ n \ tat org. springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) \ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterCha \ n * 334 *): 334 * 10: * * * 334 *): * \ tat org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter (AbstractAuthenticationProcessingFilter. java: 200) \ r \ n \ tat org.springframework.security.web.FilterChainProxy $ FilterFdoter (VirtualFilter). 334) \ r \ n \ tat org.springframework.security.web.authentication.logout.LogoutFilter.doFilter (LogoutFilter. java: 116) \ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain. doFilter (FilterChainProxy. java: 334) \ r \ n \ tat org.springframework.security.web.header. HeaderWriterFilter.doHeadersAfter (HeaderWriterFilter. java: 92) \ r \ n \ tat org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal (HeaderWriterFilter. java: 77) \ r \ n. web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) \ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (FilterChainProxy. * 1052 \ 334): 334) org.springframework.security. \ r \ n \ tat org.springframework.security.web.context.request.asyn c .WebAsyncManagerIntegrationFilter.doFilterInternal (WebAsyncManagerIntegrationFilter. java: 56) \ r \ n \ tat org.springfilqu.web. .doFilter (OncePerRequestFilter. java: 119) \ r \ n \ tat org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter (Filt erChainProxy. java: 334) \ r \ n \ tat org.springframework.security.web.FilterChainProxy.doFilterInternal (FilterChainProxy. java: 215) \ r \ n \ tat org.springframework.security.web.FilterChainProxy. doFilter (FilterChainProxy. java: 178) \ r \ n \ tat org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (DelegatingFilterProxy. java: 358) \ r \ n \ tat org.springframework.web.filter. DelegatingFilterProxy.doFilter (DelegatingFilterProxy. java: 271) \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) \ r \ n \ tat org.springframework.web.filter.RequestContextFilter.doFilterInternal (RequestContextFilter. java: 100 \ r) org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain * 19: 10) * \ n \ tat org. apache .catalina.core. ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) \ r \ n \ tat org.springframework.web.filter.FormContentFilter.doFilterInternal (FormContentFilter. java: 93) \ r \ n \ tat org.springframework. filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. java: 193) \ r \ n \ tat или apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) \ r \ n \ tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (CharacterEncodingFilter. \ tat org.springframework.web.filter.OncePerRequestFilter.doFilter (OncePerRequestFilter. java: 119) \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain. \ r \ n \ tat org. apache .catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain. java: 166) \ r \ n \ tat org. apache .catalina.core.StandardWrapperValve.invoke (StandardWrapperValve. java: 202) \ r \ n \ tat org. apache .catalina.core.StandardContextValve.invoke (StandardContextValve. java: 96) \ r \ n \ tat org. apache .catalina.authenticator.AuthenticatorBase.invoke (AuthenticatorBase. *) 1090 *: 541) \ r \ n \ tat org. apache .catalina.core.StandardHostValve.invoke (StandardHostValve. java: 139) \ r \ n \ tat org. apache .catalina.valves.ErrorReportValve .invoke (ErrorReportValve. java: 92) \ r \ n \ tat org. apache .catalina.core.StandardEngineValve.invoke (StandardEngineValve. java: 74) \ r \ n \ tat org. apache .catalina.connector.CoyoteAdapter.service (CoyoteAdapter. java: 343) \ r \ n \ tat org. apache .coyote.http11.Http11Processor.service (Http11Processor. java: 367) \ r \ n \ tat org. apache .coyote.AbstractProcessorLight.process (AbstractProcessorLight. java: 65) \ r \ n \ tat org. apache .coyote.AbstractProtocol $ ConnectionHandler.process (AbstractProtocol. java: 868) \ r \ n \ tat org. apache .tomcat.util. net .NioEndpoint $ SocketProcessor.doRun (NioEndpoint. java: 1639) \ r \ n \ tat org. apache .tomcat.util. net .SocketProcessorBase.run (SocketProcessorBase. java: 49) \ r \ n \ tat java .util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor. java: 1149) \ r \ n \ tat java .util.concurrent.ThreadPoolExecutor $ Worker. run (ThreadPoolExecutor. java: 624) \ r \ n \ tat org. apache .tomcat.util.threads.TaskThread $ WrappingRunnable.run (TaskThread. java: 61) \ r \ n \ tat java .lang.Thread.run (Thread. java: 748) \ r \ nОткрыт: java .io.IOException: поток закрыт \ r \ n \ tat org. apache .catalina.connector.InputBuffer. readByte (InputBuffer. java: 347) \ r \ n \ tat org. apache .catalina.connector.CoyoteInputStream.read (CoyoteInputStream. java: 84) \ r \ n \ tat java .io. FilterInputStream.read (FilterInputStream. java: 83) \ r \ n \ tat java .io.PushbackInputStream.read (PushbackInputStream. java: 139) \ r \ n \ tat org.springframework.web.servlet. mvc .method.annotation.AbstractMessageConverterMethodArgumentResolver $ EmptyBodyCheckingHttpInputMessage. (AbstractMessageConverterMethodArgumentResolver. java: 325) \ r \ n \ tat org.springframework.hob. erMethodArgumentResolver.readWithMessageConverters (AbstractMessageConverterMethodArgumentResolver. java: 194) \ r \ n \ t ... 69 больше \ r \ n "," путь ":" / flightreservation / users / "}

Мой метод createUser в контроллере:

@PostMapping
public  UserCreateResponseModel createUser( @RequestBody 
UserCreateRequestModel userRequest ) {
    LOGGER.info("Inside createUserMethod() ");
    ModelMapper modelMapper = new ModelMapper();
    UserDto userDto = modelMapper.map(userRequest, UserDto.class);
    UserDto savedDto = userService.createUser(userDto);
    UserCreateResponseModel userResponse = modelMapper.map(savedDto, 
    UserCreateResponseModel.class);
    return userResponse;
}

createUser на Сервисе:

public UserDto createUser(UserDto userDto) {
    UserEntity storedUserDetails = userRepo.findByEmail(userDto.getEmail());
    if(storedUserDetails != null) throw new RuntimeException("Record aleary exists !!");
    UserEntity userEntity = new UserEntity();
    BeanUtils.copyProperties(userDto , userEntity);
    String publicUserId = generateId.generateUserId(30);
    userEntity.setUserId(publicUserId);
    userEntity.setEncryptedPassword(bCryptPasswordEncoder.encode(userDto.getPassword()));
    UserEntity  saveduser = userRepo.save(userEntity);
    UserDto returnValue = new UserDto();
    BeanUtils.copyProperties(saveduser , returnValue);
    return returnValue;
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...