You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Java Energizer <jo...@daggerpoint.net> on 2006/12/30 12:29:45 UTC

Marshal error with JAXB in servicemix

I can do it standalone and it works OK, but 
Attempt to marshal inside of servicemix fails.
Getting a JAXBContext  context works fine, finds my package
that I created using the xjc.sh compiler.  However,
the line to marshal into a DOM fails.
snip....
JAXBContext jc = JAXBContext.newInstance( package.name );
Marshal m = jc.createMarshaller();
m.marshal( (ObjectFactory) obj, (Document) doc );
....
Fails with stack trace saying that my pakcage.name.obj is not known
to the JAXB context nor any of its super classes.   Is this an indication
that servicemix needs to be identified as the provider?    DO I need
to reference the package in an xbean.xml file somewhere?
OH, BTWY, this is running inside a PoJo that works as expected.

Re: Marshal error with JAXB in servicemix

Posted by Java Energizer <jo...@daggerpoint.net>.
Yes package is available.  It is found successfully
in the line that creates new instance of JAXBContext.
It throws the exception on the last line of snippet,
on the marshal.

On Sat, 2006-12-30 at 08:07, Guillaume Nodet wrote:

> It may be a class loader problem ...
> Is your package available from this code snippet ?
> 
> On 12/30/06, Java Energizer <jo...@daggerpoint.net> wrote:
> > I can do it standalone and it works OK, but
> > Attempt to marshal inside of servicemix fails.
> > Getting a JAXBContext  context works fine, finds my package
> > that I created using the xjc.sh compiler.  However,
> > the line to marshal into a DOM fails.
> > snip....
> > JAXBContext jc = JAXBContext.newInstance( package.name );
> > Marshal m = jc.createMarshaller();
> > m.marshal( (ObjectFactory) obj, (Document) doc );
> > ....
> > Fails with stack trace saying that my pakcage.name.obj is not known
> > to the JAXB context nor any of its super classes.   Is this an indication
> > that servicemix needs to be identified as the provider?    DO I need
> > to reference the package in an xbean.xml file somewhere?
> > OH, BTWY, this is running inside a PoJo that works as expected.
> >
> >
> 
> 
> -- 
> Cheers,
> Guillaume Nodet

Re: Marshal error with JAXB in servicemix

Posted by Guillaume Nodet <gn...@gmail.com>.
It may be a class loader problem ...
Is your package available from this code snippet ?

On 12/30/06, Java Energizer <jo...@daggerpoint.net> wrote:
> I can do it standalone and it works OK, but
> Attempt to marshal inside of servicemix fails.
> Getting a JAXBContext  context works fine, finds my package
> that I created using the xjc.sh compiler.  However,
> the line to marshal into a DOM fails.
> snip....
> JAXBContext jc = JAXBContext.newInstance( package.name );
> Marshal m = jc.createMarshaller();
> m.marshal( (ObjectFactory) obj, (Document) doc );
> ....
> Fails with stack trace saying that my pakcage.name.obj is not known
> to the JAXB context nor any of its super classes.   Is this an indication
> that servicemix needs to be identified as the provider?    DO I need
> to reference the package in an xbean.xml file somewhere?
> OH, BTWY, this is running inside a PoJo that works as expected.
>
>


-- 
Cheers,
Guillaume Nodet

Re: Marshal error with JAXB in servicemix

Posted by moraleslos <mo...@hotmail.com>.
Technically you don't need it but I ran into similar problems before and the
jaxb.index solved the issue.  However, since you said it works outside of
SMX w/o it, then it should also work inside SMX w/o it.  Did you try it
anyhow?

You're also trying to marshal from POJO to xml.  How is this process being
done?  Anything you send into the NMR must be well-formed XML so if you're
are trying to marshal the POJO by passing it to another component inside the
NMR as a POJO, its not going to work (unless you use a binary marshaler).

HTH,

-los


Java Energizer wrote:
> 
> No, I do not have an jaxb.index.  It was my understanding that
> it was optional?  Is it required with servicemix?
> My code works OK outside of servicemix.  
> 
> On Sat, 2006-12-30 at 14:29, moraleslos wrote:
> 
>> Do you have a jaxb.index file in your package that describes all the
>> classes
>> participating in jaxb2?  Not sure if this will solve your problem though
>> but
>> give it a shot...
>> 
>> -los
>> 
>> 
>> Java Energizer wrote:
>> > 
>> > I can do it standalone and it works OK, but 
>> > Attempt to marshal inside of servicemix fails.
>> > Getting a JAXBContext  context works fine, finds my package
>> > that I created using the xjc.sh compiler.  However,
>> > the line to marshal into a DOM fails.
>> > snip....
>> > JAXBContext jc = JAXBContext.newInstance( package.name );
>> > Marshal m = jc.createMarshaller();
>> > m.marshal( (ObjectFactory) obj, (Document) doc );
>> > ....
>> > Fails with stack trace saying that my pakcage.name.obj is not known
>> > to the JAXB context nor any of its super classes.   Is this an
>> indication
>> > that servicemix needs to be identified as the provider?    DO I need
>> > to reference the package in an xbean.xml file somewhere?
>> > OH, BTWY, this is running inside a PoJo that works as expected.
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8100837
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8109015
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Marshal error with JAXB in servicemix

Posted by Java Energizer <jo...@daggerpoint.net>.
No, I do not have an jaxb.index.  It was my understanding that
it was optional?  Is it required with servicemix?
My code works OK outside of servicemix.  

On Sat, 2006-12-30 at 14:29, moraleslos wrote:

> Do you have a jaxb.index file in your package that describes all the classes
> participating in jaxb2?  Not sure if this will solve your problem though but
> give it a shot...
> 
> -los
> 
> 
> Java Energizer wrote:
> > 
> > I can do it standalone and it works OK, but 
> > Attempt to marshal inside of servicemix fails.
> > Getting a JAXBContext  context works fine, finds my package
> > that I created using the xjc.sh compiler.  However,
> > the line to marshal into a DOM fails.
> > snip....
> > JAXBContext jc = JAXBContext.newInstance( package.name );
> > Marshal m = jc.createMarshaller();
> > m.marshal( (ObjectFactory) obj, (Document) doc );
> > ....
> > Fails with stack trace saying that my pakcage.name.obj is not known
> > to the JAXB context nor any of its super classes.   Is this an indication
> > that servicemix needs to be identified as the provider?    DO I need
> > to reference the package in an xbean.xml file somewhere?
> > OH, BTWY, this is running inside a PoJo that works as expected.
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8100837
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Marshal error with JAXB in servicemix

Posted by moraleslos <mo...@hotmail.com>.
Do you have a jaxb.index file in your package that describes all the classes
participating in jaxb2?  Not sure if this will solve your problem though but
give it a shot...

-los


Java Energizer wrote:
> 
> I can do it standalone and it works OK, but 
> Attempt to marshal inside of servicemix fails.
> Getting a JAXBContext  context works fine, finds my package
> that I created using the xjc.sh compiler.  However,
> the line to marshal into a DOM fails.
> snip....
> JAXBContext jc = JAXBContext.newInstance( package.name );
> Marshal m = jc.createMarshaller();
> m.marshal( (ObjectFactory) obj, (Document) doc );
> ....
> Fails with stack trace saying that my pakcage.name.obj is not known
> to the JAXB context nor any of its super classes.   Is this an indication
> that servicemix needs to be identified as the provider?    DO I need
> to reference the package in an xbean.xml file somewhere?
> OH, BTWY, this is running inside a PoJo that works as expected.
> 
> 

-- 
View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8100837
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Marshal error with JAXB in servicemix

Posted by Java Energizer <jo...@daggerpoint.net>.
GAve it one last shot as prescribed in the jaxb-2 instructions
and  I got it working - converts a pojo to xml and pass
it into NMR to awaiting service assembly.  Works GOOD!
All the data that was in the pojo gets converted to
XML and is extractable as a XMLdoc from SA.  
It appears to work fast.  However, the jury is still
out on how fast it works and how many can be processed
at the break neck speeds I want.    ANYONE have
an idea on scalability using JAXB-2 with SMX???


On Tue, 2007-01-02 at 09:57, moraleslos wrote:

> I'm used to sending it as a file, but in your case you may have to send it
> serialized.  I use the File example from SMX 3.0 to see how it handles
> marshaling/unmarshaling.  When you look at it, you can see it uses a
> BinaryMarshaler instead of the DefaultMarshaler, and all it does it attaches
> the file (stream).  
> 
> HTH,
> 
> -mikev
> 
> 
> 
> Java Energizer wrote:
> > 
> > Is there a Howto on sending a pojo as an attachment?  For both
> > packaging it up and unpackaging?  (Marshal/Unmarshal)  ??
> > TIA
> > On Sun, 2006-12-31 at 13:40, moraleslos wrote:
> > 
> >> Yes, its needs to be XML unless you use something like a
> >> BinaryFileMarshaler
> >> or similar where your POJO is sent as an attachment into the NMR.  The
> >> provider component must then expect it as an attachment in order to do
> >> something useful.
> >> 
> >> HTH,
> >> 
> >> -los
> >> 
> >> 
> >> Java Energizer wrote:
> >> > 
> >> > Is there a working example somewhere?  Or perhaps I am
> >> > doing this wrong?  I simply have a legacy java object
> >> > that I need to convert to XML so that I can send it onto
> >> > the NMR to other waiting Service Assemblies, that may
> >> > be local or on another machine.  Can I use a PoJo to
> >> > send out via the NMR?  Looks like it needs to be XML?
> >> > 
> >> > 
> >> > On Sat, 2006-12-30 at 06:29, Java Energizer wrote:
> >> > 
> >> >> I can do it standalone and it works OK, but 
> >> >> Attempt to marshal inside of servicemix fails.
> >> >> Getting a JAXBContext  context works fine, finds my package
> >> >> that I created using the xjc.sh compiler.  However,
> >> >> the line to marshal into a DOM fails.
> >> >> snip....
> >> >> JAXBContext jc = JAXBContext.newInstance( package.name );
> >> >> Marshal m = jc.createMarshaller();
> >> >> m.marshal( (ObjectFactory) obj, (Document) doc );
> >> >> ....
> >> >> Fails with stack trace saying that my pakcage.name.obj is not known
> >> >> to the JAXB context nor any of its super classes.   Is this an
> >> indication
> >> >> that servicemix needs to be identified as the provider?    DO I need
> >> >> to reference the package in an xbean.xml file somewhere?
> >> >> OH, BTWY, this is running inside a PoJo that works as expected.
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8109058
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8125077
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Marshal error with JAXB in servicemix

Posted by moraleslos <mo...@hotmail.com>.
I'm used to sending it as a file, but in your case you may have to send it
serialized.  I use the File example from SMX 3.0 to see how it handles
marshaling/unmarshaling.  When you look at it, you can see it uses a
BinaryMarshaler instead of the DefaultMarshaler, and all it does it attaches
the file (stream).  

HTH,

-mikev



Java Energizer wrote:
> 
> Is there a Howto on sending a pojo as an attachment?  For both
> packaging it up and unpackaging?  (Marshal/Unmarshal)  ??
> TIA
> On Sun, 2006-12-31 at 13:40, moraleslos wrote:
> 
>> Yes, its needs to be XML unless you use something like a
>> BinaryFileMarshaler
>> or similar where your POJO is sent as an attachment into the NMR.  The
>> provider component must then expect it as an attachment in order to do
>> something useful.
>> 
>> HTH,
>> 
>> -los
>> 
>> 
>> Java Energizer wrote:
>> > 
>> > Is there a working example somewhere?  Or perhaps I am
>> > doing this wrong?  I simply have a legacy java object
>> > that I need to convert to XML so that I can send it onto
>> > the NMR to other waiting Service Assemblies, that may
>> > be local or on another machine.  Can I use a PoJo to
>> > send out via the NMR?  Looks like it needs to be XML?
>> > 
>> > 
>> > On Sat, 2006-12-30 at 06:29, Java Energizer wrote:
>> > 
>> >> I can do it standalone and it works OK, but 
>> >> Attempt to marshal inside of servicemix fails.
>> >> Getting a JAXBContext  context works fine, finds my package
>> >> that I created using the xjc.sh compiler.  However,
>> >> the line to marshal into a DOM fails.
>> >> snip....
>> >> JAXBContext jc = JAXBContext.newInstance( package.name );
>> >> Marshal m = jc.createMarshaller();
>> >> m.marshal( (ObjectFactory) obj, (Document) doc );
>> >> ....
>> >> Fails with stack trace saying that my pakcage.name.obj is not known
>> >> to the JAXB context nor any of its super classes.   Is this an
>> indication
>> >> that servicemix needs to be identified as the provider?    DO I need
>> >> to reference the package in an xbean.xml file somewhere?
>> >> OH, BTWY, this is running inside a PoJo that works as expected.
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8109058
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8125077
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Marshal error with JAXB in servicemix

Posted by Java Energizer <jo...@daggerpoint.net>.
Is there a Howto on sending a pojo as an attachment?  For both
packaging it up and unpackaging?  (Marshal/Unmarshal)  ??
TIA
On Sun, 2006-12-31 at 13:40, moraleslos wrote:

> Yes, its needs to be XML unless you use something like a BinaryFileMarshaler
> or similar where your POJO is sent as an attachment into the NMR.  The
> provider component must then expect it as an attachment in order to do
> something useful.
> 
> HTH,
> 
> -los
> 
> 
> Java Energizer wrote:
> > 
> > Is there a working example somewhere?  Or perhaps I am
> > doing this wrong?  I simply have a legacy java object
> > that I need to convert to XML so that I can send it onto
> > the NMR to other waiting Service Assemblies, that may
> > be local or on another machine.  Can I use a PoJo to
> > send out via the NMR?  Looks like it needs to be XML?
> > 
> > 
> > On Sat, 2006-12-30 at 06:29, Java Energizer wrote:
> > 
> >> I can do it standalone and it works OK, but 
> >> Attempt to marshal inside of servicemix fails.
> >> Getting a JAXBContext  context works fine, finds my package
> >> that I created using the xjc.sh compiler.  However,
> >> the line to marshal into a DOM fails.
> >> snip....
> >> JAXBContext jc = JAXBContext.newInstance( package.name );
> >> Marshal m = jc.createMarshaller();
> >> m.marshal( (ObjectFactory) obj, (Document) doc );
> >> ....
> >> Fails with stack trace saying that my pakcage.name.obj is not known
> >> to the JAXB context nor any of its super classes.   Is this an indication
> >> that servicemix needs to be identified as the provider?    DO I need
> >> to reference the package in an xbean.xml file somewhere?
> >> OH, BTWY, this is running inside a PoJo that works as expected.
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8109058
> Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Marshal error with JAXB in servicemix

Posted by moraleslos <mo...@hotmail.com>.
Yes, its needs to be XML unless you use something like a BinaryFileMarshaler
or similar where your POJO is sent as an attachment into the NMR.  The
provider component must then expect it as an attachment in order to do
something useful.

HTH,

-los


Java Energizer wrote:
> 
> Is there a working example somewhere?  Or perhaps I am
> doing this wrong?  I simply have a legacy java object
> that I need to convert to XML so that I can send it onto
> the NMR to other waiting Service Assemblies, that may
> be local or on another machine.  Can I use a PoJo to
> send out via the NMR?  Looks like it needs to be XML?
> 
> 
> On Sat, 2006-12-30 at 06:29, Java Energizer wrote:
> 
>> I can do it standalone and it works OK, but 
>> Attempt to marshal inside of servicemix fails.
>> Getting a JAXBContext  context works fine, finds my package
>> that I created using the xjc.sh compiler.  However,
>> the line to marshal into a DOM fails.
>> snip....
>> JAXBContext jc = JAXBContext.newInstance( package.name );
>> Marshal m = jc.createMarshaller();
>> m.marshal( (ObjectFactory) obj, (Document) doc );
>> ....
>> Fails with stack trace saying that my pakcage.name.obj is not known
>> to the JAXB context nor any of its super classes.   Is this an indication
>> that servicemix needs to be identified as the provider?    DO I need
>> to reference the package in an xbean.xml file somewhere?
>> OH, BTWY, this is running inside a PoJo that works as expected.
> 
> 

-- 
View this message in context: http://www.nabble.com/Marshal-error-with-JAXB-in-servicemix-tf2898235s12049.html#a8109058
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Marshal error with JAXB in servicemix

Posted by Java Energizer <jo...@daggerpoint.net>.
Is there a working example somewhere?  Or perhaps I am
doing this wrong?  I simply have a legacy java object
that I need to convert to XML so that I can send it onto
the NMR to other waiting Service Assemblies, that may
be local or on another machine.  Can I use a PoJo to
send out via the NMR?  Looks like it needs to be XML?


On Sat, 2006-12-30 at 06:29, Java Energizer wrote:

> I can do it standalone and it works OK, but 
> Attempt to marshal inside of servicemix fails.
> Getting a JAXBContext  context works fine, finds my package
> that I created using the xjc.sh compiler.  However,
> the line to marshal into a DOM fails.
> snip....
> JAXBContext jc = JAXBContext.newInstance( package.name );
> Marshal m = jc.createMarshaller();
> m.marshal( (ObjectFactory) obj, (Document) doc );
> ....
> Fails with stack trace saying that my pakcage.name.obj is not known
> to the JAXB context nor any of its super classes.   Is this an indication
> that servicemix needs to be identified as the provider?    DO I need
> to reference the package in an xbean.xml file somewhere?
> OH, BTWY, this is running inside a PoJo that works as expected.