java - REST Jersey 异常 AbstractJAXBProvider

标签 java web-services rest jakarta-ee

我有这个资源

@Path("customer")
public class Customers

在它里面,我有这个功能:

@Path("signin/{mobileNumber}/{simNumber}/{password}")
    @GET
    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public CustomerImpl signgin(@PathParam("mobileNumber") String mobileNumber,
            @PathParam("simNumber") String simNumber,
            @PathParam("password") String password) {
        // return "dddddddddddddddddddddddddddddddd";
        return CustomerWraper.instance.getOne(1);
    }

当我调用该函数时出现异常,

我正在使用customerWraper:

public enum CustomerWraper {
    instance;
    private Map<Integer, CustomerImpl> customers = new HashMap<Integer, CustomerImpl>();

    public Map<Integer, CustomerImpl> getData() {
        return customers;
    }

    private CustomerWraper() {
        CustomerImpl c = (CustomerImpl)CustomerImpl.getCustomer(1);
        this.customers.put(1, c);
    }

    public CustomerImpl getOne(int ID) {
        CustomerImpl customer = getData().get(ID);
        if (customer == null) {
            //customer = (CustomerImpl) CustomerImpl.getCustomer(ID);
            customer = new CustomerImpl("0999440921", "123", "123");
        }
        return customer;
    }
}

注意:

customerImpl 类是这样的:

@XmlRootElement(name = "customer")
public class CustomerImpl extends com.syriatel.eattel.user.User implements
        Customer {

User 类是抽象的。

异常(exception)的是:(很长,看最后)

May 20, 2013 1:49:12 AM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 23 counts of IllegalAnnotationExceptions
com.syriatel.eattel.user.Customer is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Customer
        at public com.syriatel.eattel.user.Customer com.syriatel.eattel.location.CustomerAddressImpl.getCustomer()
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.Customer does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Customer
        at public com.syriatel.eattel.user.Customer com.syriatel.eattel.location.CustomerAddressImpl.getCustomer()
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Area is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Area
        at public com.syriatel.eattel.location.Area com.syriatel.eattel.location.AddressImpl.getArea()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Area does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Area
        at public com.syriatel.eattel.location.Area com.syriatel.eattel.location.AddressImpl.getArea()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.City is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.City
        at public com.syriatel.eattel.location.City com.syriatel.eattel.location.AddressImpl.getCity()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.City does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.City
        at public com.syriatel.eattel.location.City com.syriatel.eattel.location.AddressImpl.getCity()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Region is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Region
        at public com.syriatel.eattel.location.Region com.syriatel.eattel.location.AddressImpl.getRegion()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Region does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Region
        at public com.syriatel.eattel.location.Region com.syriatel.eattel.location.AddressImpl.getRegion()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.FavoriteFood does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.FavoriteFood
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteFoods()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.food.RestaurantFood is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.food.RestaurantFood
        at public com.syriatel.eattel.food.RestaurantFood com.syriatel.eattel.user.FavoriteFood.getFood()
        at com.syriatel.eattel.user.FavoriteFood
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteFoods()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.food.RestaurantFood does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.food.RestaurantFood
        at public com.syriatel.eattel.food.RestaurantFood com.syriatel.eattel.user.FavoriteFood.getFood()
        at com.syriatel.eattel.user.FavoriteFood
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteFoods()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.FavoriteRestaurant does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.FavoriteRestaurant
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteRestaurants()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.OrderImpl does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.CustomerAddress is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.CustomerAddress
        at public com.syriatel.eattel.location.CustomerAddress com.syriatel.eattel.order.OrderImpl.getAddress()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.CustomerAddress does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.CustomerAddress
        at public com.syriatel.eattel.location.CustomerAddress com.syriatel.eattel.order.OrderImpl.getAddress()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.FoodOrder is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.order.FoodOrder
        at public java.util.List com.syriatel.eattel.order.OrderImpl.getFoods()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.FoodOrder does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.FoodOrder
        at public java.util.List com.syriatel.eattel.order.OrderImpl.getFoods()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.Restaurant is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Restaurant
        at public com.syriatel.eattel.user.Restaurant com.syriatel.eattel.order.OrderImpl.getRestaurant()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.Restaurant does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Restaurant
        at public com.syriatel.eattel.user.Restaurant com.syriatel.eattel.order.OrderImpl.getRestaurant()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.OrderStatus does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
java.sql.Timestamp does not have a no-arg default constructor.
    this problem is related to the following location:
        at java.sql.Timestamp
        at public java.sql.Timestamp com.syriatel.eattel.order.OrderStatus.getEndDate()
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.Order is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.order.Order
        at public com.syriatel.eattel.order.Order com.syriatel.eattel.order.OrderStatus.getOrder()
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.Order does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.Order
        at public com.syriatel.eattel.order.Order com.syriatel.eattel.order.OrderStatus.getOrder()
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl

    at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:159)
    at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1479)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 23 counts of IllegalAnnotationExceptions
com.syriatel.eattel.user.Customer is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Customer
        at public com.syriatel.eattel.user.Customer com.syriatel.eattel.location.CustomerAddressImpl.getCustomer()
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.Customer does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Customer
        at public com.syriatel.eattel.user.Customer com.syriatel.eattel.location.CustomerAddressImpl.getCustomer()
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Area is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Area
        at public com.syriatel.eattel.location.Area com.syriatel.eattel.location.AddressImpl.getArea()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Area does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Area
        at public com.syriatel.eattel.location.Area com.syriatel.eattel.location.AddressImpl.getArea()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.City is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.City
        at public com.syriatel.eattel.location.City com.syriatel.eattel.location.AddressImpl.getCity()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.City does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.City
        at public com.syriatel.eattel.location.City com.syriatel.eattel.location.AddressImpl.getCity()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Region is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Region
        at public com.syriatel.eattel.location.Region com.syriatel.eattel.location.AddressImpl.getRegion()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.Region does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.Region
        at public com.syriatel.eattel.location.Region com.syriatel.eattel.location.AddressImpl.getRegion()
        at com.syriatel.eattel.location.AddressImpl
        at com.syriatel.eattel.location.CustomerAddressImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getAddresses()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.FavoriteFood does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.FavoriteFood
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteFoods()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.food.RestaurantFood is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.food.RestaurantFood
        at public com.syriatel.eattel.food.RestaurantFood com.syriatel.eattel.user.FavoriteFood.getFood()
        at com.syriatel.eattel.user.FavoriteFood
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteFoods()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.food.RestaurantFood does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.food.RestaurantFood
        at public com.syriatel.eattel.food.RestaurantFood com.syriatel.eattel.user.FavoriteFood.getFood()
        at com.syriatel.eattel.user.FavoriteFood
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteFoods()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.FavoriteRestaurant does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.FavoriteRestaurant
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getFavoriteRestaurants()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.OrderImpl does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.CustomerAddress is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.location.CustomerAddress
        at public com.syriatel.eattel.location.CustomerAddress com.syriatel.eattel.order.OrderImpl.getAddress()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.location.CustomerAddress does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.location.CustomerAddress
        at public com.syriatel.eattel.location.CustomerAddress com.syriatel.eattel.order.OrderImpl.getAddress()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.FoodOrder is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.order.FoodOrder
        at public java.util.List com.syriatel.eattel.order.OrderImpl.getFoods()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.FoodOrder does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.FoodOrder
        at public java.util.List com.syriatel.eattel.order.OrderImpl.getFoods()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.Restaurant is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Restaurant
        at public com.syriatel.eattel.user.Restaurant com.syriatel.eattel.order.OrderImpl.getRestaurant()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.user.Restaurant does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.user.Restaurant
        at public com.syriatel.eattel.user.Restaurant com.syriatel.eattel.order.OrderImpl.getRestaurant()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.OrderStatus does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
java.sql.Timestamp does not have a no-arg default constructor.
    this problem is related to the following location:
        at java.sql.Timestamp
        at public java.sql.Timestamp com.syriatel.eattel.order.OrderStatus.getEndDate()
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.Order is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at com.syriatel.eattel.order.Order
        at public com.syriatel.eattel.order.Order com.syriatel.eattel.order.OrderStatus.getOrder()
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl
com.syriatel.eattel.order.Order does not have a no-arg default constructor.
    this problem is related to the following location:
        at com.syriatel.eattel.order.Order
        at public com.syriatel.eattel.order.Order com.syriatel.eattel.order.OrderStatus.getOrder()
        at com.syriatel.eattel.order.OrderStatus
        at public com.syriatel.eattel.order.OrderStatus com.syriatel.eattel.order.OrderImpl.getStatus()
        at com.syriatel.eattel.order.OrderImpl
        at public java.util.List com.syriatel.eattel.user.CustomerImpl.getOrders()
        at com.syriatel.eattel.user.CustomerImpl

    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
    at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
    at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.find(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getStoredJAXBContext(AbstractJAXBProvider.java:194)
    at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getJAXBContext(AbstractJAXBProvider.java:187)
    at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:165)
    at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.getMarshaller(AbstractJAXBProvider.java:144)
    at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:151)
    ... 25 more

最佳答案

这是堆栈跟踪中有趣的一行;

com.syriatel.eattel.user.Customer is an interface, and JAXB can't handle interfaces.

与您发布的内容相比,您的堆栈跟踪清楚地显示了更多的类。请再次检查您的代码。在某个地方,“客户”接口(interface)被直接引用,或者以导致 Jersey 尝试直接启动它的方式引用。

如果可以的话,我建议完全摆脱 Interface,只是暂时这样做,只是为了确保这是真正的罪魁祸首。

关于java - REST Jersey 异常 AbstractJAXBProvider,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16645827/

相关文章:

java - 安卓/Java : how to know what is the type of a remote audio streaming file ?

r - 如何使用opencpu在R中传递参数

python - 如何从 Python Eve 应用程序中取消设置字段?

java - 布局在 Windows 7 中被破坏,但在 Windows XP 中看起来不错

java - 重复的 XML 条目 | Hibernate orm.xml

java - 使用 CXF 和 wsdl2java 生成代码时解决冲突

php - 您如何使用 SLIM Microframework 组织大型 Rest API?

java - ReSTLet 添加参数到 webservice 调用

java - 如何将多个参数从 Jolie 传递到嵌入式 Java 服务?

java - 将现有功能公开为 Web 服务的高效且简单的方法