users@jaxb.java.net

JAXB unsupported operation exception

From: Brian Pontarelli <brian_at_pontarelli.com>
Date: Sun, 03 Jul 2005 14:57:57 -0500

So, I figured this out by looking and debugging around in the JAXB
source code.

Here's what happened:

I had a class that looked like this:

@XmlType(name = "")
public class Param {
  @XmlValue() private String value;
  @XmlAttribute() private String name;

  public String getValue() {...}
  public void setValue(String value) {...}
  public String getName() {...}
  public String setName(String name) {...}
}

The problem occurred because I had a value/attribute and properties in
the same class, without using @XmlTransient on the properties or
@XmlAccessorType(AccessType.FIELD) on the class. JAXB got peeved because
I had both field definitions and properties and you can't have both.

These UnsupportedOperationException throws should really be updated to
have better error messages since this is a likely problem when building
your own JAXB beans.