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 19:10:58 -0400

I wonder if this is the problem. From the AbstractUnmarshallerImpl javadoc:

* Default implementation of the setProperty method always
* throws PropertyException since there are no required
* properties. If a provider needs to handle additional
* properties, it should override this method in a derived class.

Could it be that there is no property to be set? If so, then how is
the unofficial jaxb guide pulling this off?

I just made the mistake of rewriting quite a bit of my project to do
this, only to get stuck here. Any help would be appreciated before I
have to restore from tape!

-Bill

On 7/2/07, William Saxton <saxton_at_gmail.com> wrote:
> Should say 'on line: u.setProperty'.
>
> On 7/2/07, William Saxton <saxton_at_gmail.com> wrote:
> > 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
> > >
> > >
> >
>