resource
private static final String ERRO_NA_IMPORTACAO_DO_ARQUIVO = "Erro na importação do arquivo !";
PessoaFisicaGateway pessoaFisicaGateway;
private final Validator validator;
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response create(@MultipartForm MultipartFormDataInput input) {
try {
PessoaFisicaRequest pessoaFisica = input.getFormDataPart("pessoaFisica", PessoaFisicaRequest.class,
PessoaFisicaRequest.class);
Set<ConstraintViolation<PessoaFisicaRequest>> violations = validator.validate(pessoaFisica);
if (!violations.isEmpty()) {
return Response.status(Response.Status.BAD_REQUEST)
.entity(ResponseError.createFromValidation(violations)).build();
}
return Response.status(Response.Status.CREATED).entity(pessoaFisicaGateway.create(input, pessoaFisica))
.build();
} catch (IOException e) {
throw new ApplicationException(ERRO_NA_IMPORTACAO_DO_ARQUIVO);
}
}
PessoaFisicaGateway
public Integer create(MultipartFormDataInput input, PessoaFisicaRequest pessoaFisica) {
MultipartFormDataOutput output = new MultipartFormDataOutput();
output.addFormData("documentacao", input.getFormDataMap().get("documentacao"),
MediaType.APPLICATION_OCTET_STREAM_TYPE);
output.addFormData("pessoaFisica", pessoaFisica, MediaType.APPLICATION_JSON_TYPE);
try {
return pessoaFisicaClient.create(BEARER + jwt.getRawToken(), output);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new ApplicationException(e.getMessage());
}
}
client
@POST|
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
Integer create(@HeaderParam(Authorization) String authorization, @MultipartForm MultipartFormDataOutput output);
Mas dá este erro.
2024-12-26 18:31:09,822 ERROR [br.com.netsoft.PessoaFisicaGatewayClient] (executor-thread-1) RESTEASY004655: Unable to invoke request: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.io.SequenceInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.LinkedList[0]->org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl$PartImpl["body"]): jakarta.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.io.SequenceInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.LinkedList[0]->org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl$PartImpl["body"])
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:361)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:427)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:134)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:103)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:61)
at jdk.proxy94/jdk.proxy94.$Proxy340.create(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jboss.resteasy.microprofile.client.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:168)
at jdk.proxy94/jdk.proxy94.$Proxy341.create(Unknown Source)
at br.com.netsoft.PessoaFisicaGatewayClient.create(PessoaFisicaGatewayClient.java:60)
at br.com.netsoft.PessoaFisicaGatewayClient_ClientProxy.create(Unknown Source)
at br.com.netsoftpessoafisica.PessoaFisicaResource.create(PessoaFisicaResource.java:55)
at br.com.netsoftpessoafisica.PessoaFisicaResource_Subclass.create$$superforward(Unknown Source)
at br.com.netsoftpessoafisica.PessoaFisicaResource_Subclass$$function$$248.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
at io.quarkus.resteasy.runtime.QuarkusRestPathTemplateInterceptor.restMethodInvoke(QuarkusRestPathTemplateInterceptor.java:39)
at io.quarkus.resteasy.runtime.QuarkusRestPathTemplateInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
at br.com.netsoftpessoafisica.PessoaFisicaResource_Subclass.create(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:154)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:118)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:560)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:452)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:413)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:415)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:378)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:70)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:429)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:240)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:154)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:321)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:157)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:229)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:842)
Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class java.io.SequenceInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.LinkedList[0]->org.jboss.resteasy.plugins.providers.multipart.MultipartInputImpl$PartImpl["body"])
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.loadHttpMethod(ManualClosingApacheHttpClient43Engine.java:487)
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:341)
... 54 more
O que pode ser ?