I'm having this issue when attempting to serialize an object that exists
within another object (complex data type).  Here are my classes:

The containing class:

@XmlRootElement(name = "result")
@XmlAccessorType(XmlAccessType.NONE)
@XmlSeeAlso({TripVO.class}
public class ResultVO { 
        @XmlElement
        private String id;
        @XmlElement
        private boolean success;
        @XmlElement
        private String[] messages;
        @XmlElement
        private Object data;
}

The data element is the one which is having issues.  In my test case, the
data element is an instance of the following class:

@XmlRootElement(name = "trip")
@XmlAccessorType(XmlAccessType.NONE)
public class TripVO {
        
        // Set by the client service
        @XmlElement
        private String id;
        @XmlElement
        private String name;
        @XmlElement
        private String tripType;
        @XmlElement
        private String userName;
        @XmlElement
        private int rank;
        
        private ArrayList<String> tags;
        
        private String desc;
        private String imageUrl;
        private String startAddress;    
        
        private int duration;
        
        @XmlElement
        private String startDate;
        
        private List<TripPointVO> points;
        

        public TripVO() {}
}

When I attempt to serialize ResultVO I get the exception: 

java.lang.IllegalStateException: Invalid JSON namespace:
http://www.w3.org/2001/XMLSchema-instance

If I leave out the @XmlSeeAlso annotation, I get:

javax.xml.bind.JAXBException: class com.randmcnally.trip.common.vo.TripVO
nor any of its super class is known to this context.

I am not using any explicitly defined namespaces, as this is a solely
JSON-based REST interface.  I want the ResultVO class to act as an envelope
for my other classes (i.e. every response will have its attributes, along
with a sub-object called data with the specific information).  Does anyone
have any idea how I can fix this?
-- 
View this message in context: 
http://www.nabble.com/Problem-serializing-complex-data-type-tp20194531p20194531.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to