users@jaxb.java.net

Re: JAXB unsupported operation exception

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 11 Jul 2005 15:55:20 -0700

I confirmed the problem. I agree with you that we need to replace this
with a better error message...


Brian Pontarelli wrote:
> 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.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com