예이 환경에서 작동해야합니다 (예 : 스프링 및 잭슨 버전 사용). 그와 같은 미스터리 오류에 직면했을 때 실패한 라이브러리에 대해 TRACE에 로그 설정을 적용해야합니다.
내 IDE에서이 예제를 설정하고 (예 : Spring4와 Jackson2를 그대로 사용), 400 개의 "잘못된 요청"오류가 발생했습니다. 나는 Jackson2 예외를 뱉어 것을 찾을 org.springframework.web
및 com.fasterxml.jackson.core
에 디버그 설정을 마약 :
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of ca.ted.TestController$Person[] out of START_OBJECT token
이 때문에 JSON이 jQuery.ajax()
호출에 공급되는이었다. 나는 배열을 감싸는 "persons":{}
개체를 제거하고 대신 단지 배열 전송 :
var arr = [
{
"firstName" : "Ramesh",
"id" : "id1",
"lastName" : "Kotha"
},
{
"firstName" : "Sathish",
"id" : "id2",
"lastName" : "Kotha"
}
];
내가 이런 짓을하지만, 다음과 같은 예외가 발생했습니다
com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class ca.ted.TestController$Person]: can not instantiate from JSON object (need to add/enable type information?)
가
Person
가있는 내부 클래스이기 때문에이 있었다 밝혀 내 제어 장치. 나는 그것을 자신의 파일
ca.ted.Person
로 옮겼으며 모든 것이 잘되었다.
희망이 도움이됩니다.
요청이 실패 할 때 로그 내용을 게시 할 수 있습니까? – geoand
@Steview'dataType : 'json', ' –