2017-04-16 1 views
0

나는 Gradle을 내 봄 부트 프로젝트를 새로 고침 한 후, 나는 다음과 같은 오류 얻을 : 스프링 부트 2.0.0.BUILD-SNAPSHOT 휴식 : _serializer를 재정의 할 수 없습니까?

{ 
    "timestamp": 1492300922752, 
    "status": 500, 
    "error": "Internal Server Error", 
    "exception": "org.springframework.http.converter.HttpMessageNotWritableException", 
    "message": "Could not write JSON document: Can not override _serializer: had a org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$NestedEntitySerializer, trying to set to com.fasterxml.jackson.databind.ser.std.StringSerializer (through reference chain: org.springframework.hateoas.PagedResources[\"_embedded\"]->java.util.Collections$UnmodifiableMap[\"orders\"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not override _serializer: had a org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$NestedEntitySerializer, trying to set to com.fasterxml.jackson.databind.ser.std.StringSerializer (through reference chain: org.springframework.hateoas.PagedResources[\"_embedded\"]->java.util.Collections$UnmodifiableMap[\"orders\"]->java.util.ArrayList[0])", 
    "path": "/orders" 
} 

내가 2.0.0.BUILD - 스냅 샷을 사용 나는 1.5.2 springBootVersion 내 프로젝트를 다운 그레이드

2017-04-16 02:00:58.845 INFO 36126 --- [ restartedMain] d.p.o.OrderRestServiceApplication  : Started OrderRestServiceApplication in 11.163 seconds (JVM running for 37480.653) 
2017-04-16 02:02:02.714 INFO 36126 --- [nio-8083-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]  : Initializing Spring FrameworkServlet 'dispatcherServlet' 
2017-04-16 02:02:02.714 INFO 36126 --- [nio-8083-exec-2] o.s.web.servlet.DispatcherServlet  : FrameworkServlet 'dispatcherServlet': initialization started 
2017-04-16 02:02:02.717 INFO 36126 --- [nio-8083-exec-2] o.s.web.servlet.DispatcherServlet  : FrameworkServlet 'dispatcherServlet': initialization completed in 3 ms 
2017-04-16 02:02:02.717 DEBUG 36126 --- [nio-8083-exec-2] o.s.b.w.s.f.OrderedRequestContextFilter : Bound request context to thread: [email protected] 
2017-04-16 02:02:02.724 DEBUG 36126 --- [nio-8083-exec-2] org.hibernate.SQL      : select order0_.id as id1_1_, order0_.create_date as create_d2_1_, order0_.customer_id as customer3_1_, order0_.ordered_date as ordered_4_1_, order0_.payment_order_id as payment_5_1_, order0_.shipping_order_id as shipping6_1_, order0_.status as status7_1_ from orders order0_ limit ? 
Hibernate: select order0_.id as id1_1_, order0_.create_date as create_d2_1_, order0_.customer_id as customer3_1_, order0_.ordered_date as ordered_4_1_, order0_.payment_order_id as payment_5_1_, order0_.shipping_order_id as shipping6_1_, order0_.status as status7_1_ from orders order0_ limit ? 
2017-04-16 02:02:02.728 DEBUG 36126 --- [nio-8083-exec-2] org.hibernate.SQL      : select count(order0_.id) as col_0_0_ from orders order0_ 
Hibernate: select count(order0_.id) as col_0_0_ from orders order0_ 
2017-04-16 02:02:02.749 WARN 36126 --- [nio-8083-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON document: Can not override _serializer: had a org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$NestedEntitySerializer, trying to set to com.fasterxml.jackson.databind.ser.std.StringSerializer (through reference chain: org.springframework.hateoas.PagedResources["_embedded"]->java.util.Collections$UnmodifiableMap["orders"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not override _serializer: had a org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$NestedEntitySerializer, trying to set to com.fasterxml.jackson.databind.ser.std.StringSerializer (through reference chain: org.springframework.hateoas.PagedResources["_embedded"]->java.util.Collections$UnmodifiableMap["orders"]->java.util.ArrayList[0]) 
2017-04-16 02:02:02.750 WARN 36126 --- [nio-8083-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved exception caused by Handler execution: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON document: Can not override _serializer: had a org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$NestedEntitySerializer, trying to set to com.fasterxml.jackson.databind.ser.std.StringSerializer (through reference chain: org.springframework.hateoas.PagedResources["_embedded"]->java.util.Collections$UnmodifiableMap["orders"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not override _serializer: had a org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$NestedEntitySerializer, trying to set to com.fasterxml.jackson.databind.ser.std.StringSerializer (through reference chain: org.springframework.hateoas.PagedResources["_embedded"]->java.util.Collections$UnmodifiableMap["orders"]->java.util.ArrayList[0]) 
2017-04-16 02:02:02.750 DEBUG 36126 --- [nio-8083-exec-2] o.s.b.w.s.f.OrderedRequestContextFilter : Cleared thread-bound request context: [email protected] 

답변

1

최근에 Spring Boot 2.0.0.M2와 동일한 문제가 있었지만 2.0.0.M2에서 사용되는 Jackson 버전에 결함이 있음을 알게되었습니다. 2.9.0.pr3에서 2.8.9으로 다운 그레이드했습니다. 이제 작동합니다.

+0

다운 그레이드를 사용하여 다른 문제가 발생했습니다. 이제 2.0.0.BUILD-SNAPSHOT 작업. 괜찮아 보입니다. – Caparvil