You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jeremy isikoff <ji...@gmail.com> on 2007/09/04 16:35:06 UTC

javax.xml.bind.MarshalException/Bind Exception with ArrayList wrapped javabean

Hi all, I have a strange problem. I have a java bean object that returns
fine from a web service
if I return a single one from the service but as soon as I wrap it in a
generic List of implemented as an array list it throws an exception.

returning by itself is as follows:
 DataDefinitionInfo d=*new* DataDefinitionInfo();
d.setId("me");
d.setDescription("desc");
d.setName("name");
return d;

returning wrapped in a list is as follows:
DataDefinitionInfo d=*new* DataDefinitionInfo();
d.setId("me");
d.setDescription("desc");
d.setName("name");
List<DataDefinitionInfo> list=*new* ArrayList<DataDefinitionInfo>();
list.add(d);
*return* list;

first service returns the object fine so I know the object serializes,
the second service pukes:

INFO: Interceptor has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault: Marshalling Error: [
Lcom.visualio.dataserver.model.DataDefinitionInfo; is not known to this
context

at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(*JAXBEncoderDecoder.java
:176*)

Caused by: *javax.xml.bind.MarshalException*- with linked exception:

[*javax.xml.bind.JAXBException*:
[Lcom.visualio.*dataserver*.model.DataDefinitionInfo;
is not known to this context]

Any thoughts?

Jeremy

Re: javax.xml.bind.MarshalException/Bind Exception with ArrayList wrapped javabean

Posted by Daniel Kulp <dk...@apache.org>.
What version of CXF are you using?  2.0 or 2.0.1?

There were a ton of fixes around lists/arrays in code first scenarios 
that went into 2.0.1.    There are even more going into 2.0.2 which 
we're working on trying to get out shortly.    You can try a snapshot:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.1-incubator-SNAPSHOT/

Dan



On Tuesday 04 September 2007, jeremy isikoff wrote:
> Hi all, I have a strange problem. I have a java bean object that
> returns fine from a web service
> if I return a single one from the service but as soon as I wrap it in
> a generic List of implemented as an array list it throws an exception.
>
> returning by itself is as follows:
>  DataDefinitionInfo d=*new* DataDefinitionInfo();
> d.setId("me");
> d.setDescription("desc");
> d.setName("name");
> return d;
>
> returning wrapped in a list is as follows:
> DataDefinitionInfo d=*new* DataDefinitionInfo();
> d.setId("me");
> d.setDescription("desc");
> d.setName("name");
> List<DataDefinitionInfo> list=*new* ArrayList<DataDefinitionInfo>();
> list.add(d);
> *return* list;
>
> first service returns the object fine so I know the object serializes,
> the second service pukes:
>
> INFO: Interceptor has thrown exception, unwinding now
>
> org.apache.cxf.interceptor.Fault: Marshalling Error: [
> Lcom.visualio.dataserver.model.DataDefinitionInfo; is not known to
> this context
>
> at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(*JAXBEncoderDecoder.ja
>va
>
> :176*)
>
> Caused by: *javax.xml.bind.MarshalException*- with linked exception:
>
> [*javax.xml.bind.JAXBException*:
> [Lcom.visualio.*dataserver*.model.DataDefinitionInfo;
> is not known to this context]
>
> Any thoughts?
>
> Jeremy



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog