1

Estou com um erro ao recuperar uma lista de objetos CSV do servidor.. Estou usando JSefa para serializar e desserializar Java Beans pra CSV e implementei um MessageBodyWriter e Reader pra fazer esta conversão nas chamadas..

O detalhe é que não estou conseguindo converter essa lista para objetos usando o GenericType do jersey..

private void listAsResponse(String mediaType) {
    Response response = target().path("produto").path("all")
            .request(mediaType).get();
    System.out.println(response.getEntity());
}

private void listAsString(String mediaType) {
    String req = target().path("produto").path("all")
            .request(mediaType).get(String.class);
    System.out.println(req);
}

//O erro ocorre nesta chamada aqui, as acima executam normalmente..
private void listAsObject(String mediaType) {
    List<ProdutoDTO> produtos = target().path("produto").path("all")
            .request(mediaType).get(new GenericType<List<ProdutoDTO>>(){});
    System.out.println(produtos);
}

Stack Trace:

javax.ws.rs.client.ResponseProcessingException
at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:869)
at org.glassfish.jersey.client.JerseyInvocation.access$800(JerseyInvocation.java:92)
at org.glassfish.jersey.client.JerseyInvocation$3.call(JerseyInvocation.java:722)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:718)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:430)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:321)
at br.net.twome.comprefacilws.test.ProdutoTest.listAsObject(ProdutoTest.java:84)
at br.net.twome.comprefacilws.test.ProdutoTest.runTest(ProdutoTest.java:30)
at br.net.twome.comprefacilws.test.ProdutoTest.test(ProdutoTest.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Alguém tem alguma ideia do porquê disso? Estou usando JSON e XML também e nestes dois casos consigo executar este teste normalmente, apenas com o CSV que o erro ocorre (no listAsObject)..

0

Você deve fazer log-in para responder a esta pergunta.

Pesquise outras perguntas com a tag .