Skip to main content

java.lang.Object and java.util.ArrayList

1 reply [Last post]
Joined: 2009-07-27

Hi folks,

I have a problem with the JAXB mapping of java.lang.Object.
Here's a snippet of my class

public class Filter implements Serializable {

private static final long serialVersionUID = 1L;

* The name of the property to filter on. It may be nested.
@XmlElement(nillable=false, required=true)
protected String property;

* The value to compare the property with. Should be of a compatible type
* with the property. Note that null is also valid for "equal"
* and "not equal" comparisons.
@XmlElement(nillable=true, required=true)
protected Object value;

The value field usually is a simple string but List should be allowed, too.

The problem is that I get the following exception on the client side in case the web service client assigns a java.util.ArrayList object to the value field:

javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.

I tried the annotation @XmlSeeAlso( {java.util.ArrayList.class} ) on the service implementation class but it didn't help.

Any idea how this requirement can be achieved?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2009-08-06

Try the Metro and JAXB forum instead.