ajax 통신 json 데이터 관련 오류
- 작성자 :
- 이*형
- 작성일 :
- 2023-11-23 11:41:22
- 조회수 :
- 1,273
- 구분 :
- 개발환경 / 4.1
- 진행상태 :
- 완료
Q
2023-11-23 11:23:03,762 DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] Mapped to com.pipc.web.TestController#insertAjax(MberVO, HttpServletRequest)
2023-11-23 11:23:03,790 DEBUG [org.springframework.web.method.HandlerMethod] Could not resolve parameter [0] in public com.pipc.service.MberVO com.pipc.web.TestController.insertAjax(com.pipc.service.MberVO,javax.servlet.http.HttpServletRequest) throws java.lang.Exception: Content type 'application/json' not supported
2023-11-23 11:23:03,790 DEBUG [org.springframework.web.method.HandlerMethod] Could not resolve parameter [0] in public com.pipc.service.MberVO com.pipc.web.TestController.insertAjax(com.pipc.service.MberVO,javax.servlet.http.HttpServletRequest) throws java.lang.Exception: Content type 'application/json' not supported
2023-11-23 11:23:03,795 WARN [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json' not supported]
2023-11-23 11:23:03,795 WARN [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json' not supported]
2023-11-23 11:23:03,795 DEBUG [org.springframework.web.servlet.DispatcherServlet] Completed 415 UNSUPPORTED_MEDIA_TYPE
2023-11-23 11:23:03,795 DEBUG [org.springframework.web.servlet.DispatcherServlet] Completed 415 UNSUPPORTED_MEDIA_TYPE
Q. ajax 통신할때 화면에서 컨트롤러로 json 형태로 데이터를 보냅니다.
하지만 컨트롤러에서 Content type 'application/json' not supported] 라는 에러메시지와 함께 데이터를 받지 못하고 있습니다.
데이터 변환 위해서 jackson-databind 디펜던시 추가하고 진행하였지만 제대로 인식하지 못하는 이유가 궁금합니다.
위에 각 설정 파일과 화면, 컨트롤러 파일과 사진 첨부드립니다.
2023-11-23 11:23:03,790 DEBUG [org.springframework.web.method.HandlerMethod] Could not resolve parameter [0] in public com.pipc.service.MberVO com.pipc.web.TestController.insertAjax(com.pipc.service.MberVO,javax.servlet.http.HttpServletRequest) throws java.lang.Exception: Content type 'application/json' not supported
2023-11-23 11:23:03,790 DEBUG [org.springframework.web.method.HandlerMethod] Could not resolve parameter [0] in public com.pipc.service.MberVO com.pipc.web.TestController.insertAjax(com.pipc.service.MberVO,javax.servlet.http.HttpServletRequest) throws java.lang.Exception: Content type 'application/json' not supported
2023-11-23 11:23:03,795 WARN [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json' not supported]
2023-11-23 11:23:03,795 WARN [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json' not supported]
2023-11-23 11:23:03,795 DEBUG [org.springframework.web.servlet.DispatcherServlet] Completed 415 UNSUPPORTED_MEDIA_TYPE
2023-11-23 11:23:03,795 DEBUG [org.springframework.web.servlet.DispatcherServlet] Completed 415 UNSUPPORTED_MEDIA_TYPE
Q. ajax 통신할때 화면에서 컨트롤러로 json 형태로 데이터를 보냅니다.
하지만 컨트롤러에서 Content type 'application/json' not supported] 라는 에러메시지와 함께 데이터를 받지 못하고 있습니다.
데이터 변환 위해서 jackson-databind 디펜던시 추가하고 진행하였지만 제대로 인식하지 못하는 이유가 궁금합니다.
위에 각 설정 파일과 화면, 컨트롤러 파일과 사진 첨부드립니다.
환경정보
-
- OS 정보 : window10
- 표준프레임워크 버전 : 전자정부프레임워크4.1
- JDK(JRE) 정보 : jdk11
- WAS 정보 : tomcat-9.0
- DB 정보 : cubrid10.2
- 기타 환경 정보 :
A
안녕하세요.
표준프레임워크센터입니다.
Content type 'application/json' not supported 에러는
주로 HTTP 요청의 Content-Type 헤더가 컨트롤러에서
예상하는 데이터 형식과 일치하지 않을 때 발생합니다.
아래의 3가지를 확인해 보시길 바랍니다.
1. Jackson 라이브러리 의존성 확인
2. @RequestBody 어노테이션 제대로 사용하였는지
3. Content-Type 설정
그래도 계속 'application/json' not supported 에러가 발생한다면,
HTTP 요청 헤더와 컨트롤러 매개변수의 타입이 잘 맞지 않는지 확인해 보시기 바랍니다.
요청과 컨트롤러 사이의 데이터 매핑이 되지 않을 수도 있습니다.
감사합니다.
표준프레임워크센터입니다.
Content type 'application/json' not supported 에러는
주로 HTTP 요청의 Content-Type 헤더가 컨트롤러에서
예상하는 데이터 형식과 일치하지 않을 때 발생합니다.
아래의 3가지를 확인해 보시길 바랍니다.
1. Jackson 라이브러리 의존성 확인
2. @RequestBody 어노테이션 제대로 사용하였는지
3. Content-Type 설정
그래도 계속 'application/json' not supported 에러가 발생한다면,
HTTP 요청 헤더와 컨트롤러 매개변수의 타입이 잘 맞지 않는지 확인해 보시기 바랍니다.
요청과 컨트롤러 사이의 데이터 매핑이 되지 않을 수도 있습니다.
감사합니다.