この例外があります。
私のオブジェクトは次のようになります。
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ObjectDTO implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8545841080597549468L;
@XmlElement(name="objectId")
private String objectId;
@XmlElement(name="owner")
private String owner;
@XmlElement(name="objectName")
private String objectName;
Constructor, getter/setter, toString, Hash...
次に、サービス メソッドを次のように呼び出します。
ClientResponse postRes = service.path("rest").path("object").accept(MediaType.APPLICATION_XML).post(ClientResponse.class, object);
私がする時
System.out.println(postRes.getEntity(ObjectDTO.class));
それは正常に動作します。しかし、オブジェクトに対して get 操作を実行しようとすると、次のようになります。
String string = postRes.getEntity(ObjectDTO.class).getObjectId();
私は例外を取得します。
javax.ws.rs.WebApplicationException: javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException: Premature end of life.]
どうしたの?