我正在尝试使用JAXB将JSON解组为Java对象,但是我收到了这个错误:
[Exception [EclipseLink-43] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Missing class for indicator field value [SUPP] of type [class java.lang.String].
Descriptor: XMLDescriptor(com.travelsoft.cameleo.bookingprocess.data.ElementJson --> [])]
at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:191)
at com.travelsoft.cameleo.bookingprocess.refactoring.action.process.SearchAvailabilityAndQuotationAction.execute(SearchAvailabilityAndQuotationAction.java:551)
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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
at com.travelsoft.cameleo.bookingprocess.refactoring.interceptor.ExternalInterceptor.intercept(ExternalInterceptor.java:62)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
类的属性看起来像这样,不起作用的属性是“originalType”:
private final static long serialVersionUID = 1L;
protected StatusJson status;
protected PriceJson priceValue;
protected PriceJson priceRule;
@XmlElement(name = "element")
protected List<ElementJson> elements;
protected PropertyJson property;
@XmlElement(name = "travellerRef")
protected List<TravellerRefJson> travellerReves;
protected PriceJson nettCosts;
protected InformationObjectJson informationObject;
@XmlAttribute
protected ElementSubTypeDefJson subType;
@XmlAttribute
protected String originalType;
@XmlAttribute
protected String groupRef;
你们有没有想法解决这个问题?
谢谢!
编辑:这是我试图解组的JSON:{
"serviceJson": {
"mandatoryService": {
"element": [
{
"descriptions": {
"description": [
{
"label": "CARBURANT J DEPART",
"providerType": "to"
}
]
},
"element": [],
"id": "TSE1",
"priceRule": {
"priceDetail": [
{
"amount": -14.0,
"descriptions": {
"description": [
{
"label": "CARBURANT J DEPART",
"providerType": "to"
}
]
},
"originalType": "SUPP",
"quantity": 2
}
]
},
"property": {
"processScope": "application",
"quantity": 1
},
"provider": {
"sourceCode": "FRAM"
},
"transient": false,
"travellerRef": [],
"type": "SUPP"
}
],
"priceValue": {
"amount": 0.0,
"priceDetail": []
}
},
"optionalService": {
"element": []
}
}
}