-
Bug
-
Resolution: Done
-
Major
-
3.0.2.Final
-
None
I have the following method:
@GET
@Path("/")
@Produces(
)
public List<PolicyDto> getPolicies(@Valid @BeanParam PolicyQueryDto queryDto);
If the validation of queryDto fail, it will throw a ValidationException.
And the same time, resteasy throw the following exception:
com.fasterxml.jackson.databind.JsonMappingException: Incompatible types: declared root type ([collection type; class java.util.List, contains [simple type, class com.ebao.zhongan.resource.dto.PolicyDto]]) vs com.ebao.rest.common.ExceptionDto
at com.fasterxml.jackson.databind.SerializerProvider._reportIncompatibleRootType(SerializerProvider.java:790)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:208)
at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:496)
at org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider.writeTo(ResteasyJackson2Provider.java:186)
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:129)
at org.jboss.resteasy.core.interception.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:62)
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:118)
at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100)
at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:122)
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:108)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:153)
If the return type of method is not a collection, everything is okay.
- is related to
-
RESTEASY-939 Generic type can be incorrect with ExceptionMapper
- Closed