且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

org.codehaus.jackson.map.JsonMappingException:无法将java.util.ArrayList的实例反序列化为START_OBJECT标记

更新时间:2022-06-05 17:09:23

I am not saying this is the way to fixed the issue. This is another way of solving the problem.

public class CustomerTest {
    final String path = "http://localhost:8080/RestEasy-Spring-MVC-Hibernate/";
    ICustomerService proxy = null;

    @Before
    public void beforeClass(){
        ResteasyClient client = new ResteasyClientBuilder().build();
        ResteasyWebTarget target = client.target(UriBuilder.fromPath(path));
        proxy = target.proxy(ICustomerService.class);
    }

    @Test
    public void testGetallcustomer() throws Exception {
        CustomerListType customers = proxy.getAllCustomerInfo();
        List<CustomerType> customerTypes = customers.getCustomerType();
        for (CustomerType customerType : customerTypes) {
            System.out.println("----------------------------------------------------");
            System.out.println("Name       : "+customerType.getName());
            System.out.println("Age        : "+customerType.getAge());
            System.out.println("CustomerId : "+customerType.getCustomerId());
        }
    }
}