users@jaxb.java.net

Re: How to use subclasses of JAXB created classes

From: William Saxton <saxton_at_gmail.com>
Date: Mon, 2 Jul 2007 12:56:01 -0400

Well, I've been playing with this for a few days and can't get it to
work. I'm getting a javax.xml.bind.PropertyException on line:

JAXBContext jc = JAXBContext.newInstance("com.sun.crae.generatedcomponents");
Unmarshaller u = jc.createUnmarshaller();
u.setProperty("com.sun.crae.generatedcomponents.ObjectFactory",CraeComponentFactory.getInstance());
return((CraeServer)u.unmarshal(reader));

Exception output:

javax.xml.bind.PropertyException:
name: com.sun.crae.genereratedcomponents.ObjectFactory
value: com.sun.crae.components.CraeComponentFactory_at_9ebcd0
        at javax.xml.bind.helpers.AbstractUnmarshallerImpl.setProperty(Unknown
Source)
        at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.setProperty(Unknown
Source)
        at com.sun.crae.components.CraeComponentXMLConverter.readerToCraeServer(CraeComponentXMLConverter.java:59)
        at com.sun.crae.dba.CraeServerDAO.get(CraeServerDAO.java:77)
        at cup.Main.main(Main.java:101)

Anyone actually get this working?

On 6/22/07, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
> Christophe Alexandre wrote:
> > Hi,
> > I'm new on the list and maybe I don't understand your problem but
> > isn't this:
> > https://jaxb.dev.java.net/guide/Adding_behaviors.html
> > an answer to your problem ?
>
> Yeah, I hope the users guide is useful, but if the pair() method that
> Bill is talking about can be auto-generated, writing a plugin might be
> in the end more productive.
>
> It depends on the size of the schema, I guess.
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>