users@jaxb.java.net

Re: How to use subclasses of JAXB created classes

From: William Saxton <saxton_at_gmail.com>
Date: Tue, 3 Jul 2007 06:38:30 -0400

Hi Christophe,

  I tried that too and it didn't work either :(

-Bill

On 7/3/07, Christophe Alexandre <alexandre_at_magillem.com> wrote:
> Hi Bill,
> I guess your problem comes from the name of the property you set.
> Try :
> > u.setProperty
> > ("com.sun.xml.bind.ObjectFactory",CraeComponentFactory.getInstance());
>
> I guess this exception is expected because
> "com.sun.crae.generatedcomponents.ObjectFactory" is not a valid property
> of the unmarshaller.
>
> Hope this helps.
> Christophe
>
> Le 3 juil. 07 à 01:10, William Saxton a écrit :
>
> > 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",CraeComponentFactor
> >> y.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.se
> >> tProperty(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
> >> > >
> >> > >
> >> >
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>