ERROR 해결

[Spring Boot] 에러해결org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: $

엘라 ELLA 2022. 12. 16. 13:00
728x90
반응형

에러메세지 )

org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing : ~

 

원인 )

View Page (html)에서 JavaScript 부분에 Ajax 통신부분에서 POST임에도 업로드 할 Data를 빼고 작성 함.

$.ajax({
    url: url,
    method: "POST",
    contentType: "application/Json",
    success: function (a) {
        console.log(a)
    },
    error: function (a, b) {
        alert("Error!")
        console.log(a)
        console.log(b)
    }
})

 

해결)

data를 Json 형식으로 보내주는 부분을 추가

$.ajax({
    url: url,
    method: "POST",
    contentType: "application/Json",
    data : JSON.stringify(data),
    success: function (a) {
        console.log(a)
    },
    error: function (a, b) {
        alert("Error!")
        console.log(a)
        console.log(b)
    }
})

 

 


 

 

게시글이 도움이 되었다면

[로그인]이 필요 없는 ❤ 눌러주세요:)

반응형