Error while retrieving Web Service Object List (CSV)

Asked

Viewed 68 times

1

I have an error retrieving a list of CSV objects from the server.. I’m using Jsefa to serialize and deserialize Java Beans for CSV and implemented a Messagebodywriter and Reader to make this conversion in calls..

The detail is that I am unable to convert this list to objects using jersey’s Generictype..

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)

Does anyone have any idea why? I am using JSON and XML as well and in these two cases I can run this test normally, only with the CSV that the error occurs (no listAsObject)..

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.