You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Yiannis Mavroukakis <im...@gameaccountnetwork.com> on 2010/10/14 16:47:26 UTC
Another one of those class java.util.ArrayList nor any of its super
class is known to this context. :-)
Hello everyone,
I'm coming up against one of those issues that leaves me scratching my head
[javax.xml.bind.JAXBException: class java.util.ArrayList nor any of
its super class is known to this context.]
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:536)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:227)
My service returns objects of type WsResponse<T> where T is the type
which contains the interesting data
In this case this is for this web method
WsResponse<List<WagerSummary>> wagerHistorySummary( Authorisation
auth , Date startDate , Date endDate ,
SimplePaging paging ) throws IllegalTokenException;
The WS call barfs, unless I do this in the interface definition of the service
@XmlSeeAlso( value = { WagerSummary.class, ArrayList.class,WsResponse.class } )
However this ends up returning just this
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:wagerHistorySummaryResponse
xmlns:ns2="http://account.external.gameaccount.com/">
<return>
<payload xsi:type="ns2:arrayList"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<response>
<code>0</code>
</response>
</return>
</ns2:wagerHistorySummaryResponse>
</soap:Body>
</soap:Envelope>
There's definitely a list of WagerSummary objects returned by the dao
that handles the data mining, but it doesn't seem to be translated
correctly by jaxb in the response.
Any pointers in the right direction would be hugely appreciated, as my
workaround so far has been to include a wrapper class that simply
carries
a List of the objects I'm interested in, but is clunky.
TIA,
Yiannis
Re: Another one of those class java.util.ArrayList nor any of its
super class is known to this context. :-)
Posted by Yiannis Mavroukakis <im...@gameaccountnetwork.com>.
Thanks for that. I will prefer the wrapped approach, as I feel that
JAXB annotations pollute the scope of my objects.
On 14 October 2010 22:29, Daniel Kulp <dk...@apache.org> wrote:
>
>> Any pointers in the right direction would be hugely appreciated, as my
>> workaround so far has been to include a wrapper class that simply
>> carries
>> a List of the objects I'm interested in, but is clunky.
>
> I really think that's the only way. JAX-WS/JAXB doesn't really handle
> generics on anything other than the List things.
>
> You could try writnig an XmlAdapter and using the @XmlJavaTypeAdapter thing
> for it, but I'm not 100% sure that would completely work in this case either.
>
> Dan
>
>
>
> On Thursday 14 October 2010 10:47:26 am Yiannis Mavroukakis wrote:
>> Hello everyone,
>>
>> I'm coming up against one of those issues that leaves me scratching my head
>>
>>
>> [javax.xml.bind.JAXBException: class java.util.ArrayList nor any of
>> its super class is known to this context.]
>> at
>> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
>> at
>> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244
>> ) at
>> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerIm
>> pl.java:75) at
>> org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java
>> :536) at
>> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:22
>> 7)
>>
>> My service returns objects of type WsResponse<T> where T is the type
>> which contains the interesting data
>>
>> In this case this is for this web method
>> WsResponse<List<WagerSummary>> wagerHistorySummary( Authorisation
>> auth , Date startDate , Date endDate ,
>> SimplePaging paging ) throws IllegalTokenException;
>>
>> The WS call barfs, unless I do this in the interface definition of the
>> service
>>
>> @XmlSeeAlso( value = { WagerSummary.class, ArrayList.class,WsResponse.class
>> } )
>>
>> However this ends up returning just this
>>
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>> <soap:Body>
>> <ns2:wagerHistorySummaryResponse
>> xmlns:ns2="http://account.external.gameaccount.com/">
>> <return>
>> <payload xsi:type="ns2:arrayList"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
>> <response>
>> <code>0</code>
>> </response>
>> </return>
>> </ns2:wagerHistorySummaryResponse>
>> </soap:Body>
>> </soap:Envelope>
>>
>> There's definitely a list of WagerSummary objects returned by the dao
>> that handles the data mining, but it doesn't seem to be translated
>> correctly by jaxb in the response.
>> Any pointers in the right direction would be hugely appreciated, as my
>> workaround so far has been to include a wrapper class that simply
>> carries
>> a List of the objects I'm interested in, but is clunky.
>>
>> TIA,
>>
>> Yiannis
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>
Re: Another one of those class java.util.ArrayList nor any of its super class is known to this context. :-)
Posted by Daniel Kulp <dk...@apache.org>.
> Any pointers in the right direction would be hugely appreciated, as my
> workaround so far has been to include a wrapper class that simply
> carries
> a List of the objects I'm interested in, but is clunky.
I really think that's the only way. JAX-WS/JAXB doesn't really handle
generics on anything other than the List things.
You could try writnig an XmlAdapter and using the @XmlJavaTypeAdapter thing
for it, but I'm not 100% sure that would completely work in this case either.
Dan
On Thursday 14 October 2010 10:47:26 am Yiannis Mavroukakis wrote:
> Hello everyone,
>
> I'm coming up against one of those issues that leaves me scratching my head
>
>
> [javax.xml.bind.JAXBException: class java.util.ArrayList nor any of
> its super class is known to this context.]
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244
> ) at
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerIm
> pl.java:75) at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java
> :536) at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:22
> 7)
>
> My service returns objects of type WsResponse<T> where T is the type
> which contains the interesting data
>
> In this case this is for this web method
> WsResponse<List<WagerSummary>> wagerHistorySummary( Authorisation
> auth , Date startDate , Date endDate ,
> SimplePaging paging ) throws IllegalTokenException;
>
> The WS call barfs, unless I do this in the interface definition of the
> service
>
> @XmlSeeAlso( value = { WagerSummary.class, ArrayList.class,WsResponse.class
> } )
>
> However this ends up returning just this
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns2:wagerHistorySummaryResponse
> xmlns:ns2="http://account.external.gameaccount.com/">
> <return>
> <payload xsi:type="ns2:arrayList"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> <response>
> <code>0</code>
> </response>
> </return>
> </ns2:wagerHistorySummaryResponse>
> </soap:Body>
> </soap:Envelope>
>
> There's definitely a list of WagerSummary objects returned by the dao
> that handles the data mining, but it doesn't seem to be translated
> correctly by jaxb in the response.
> Any pointers in the right direction would be hugely appreciated, as my
> workaround so far has been to include a wrapper class that simply
> carries
> a List of the objects I'm interested in, but is clunky.
>
> TIA,
>
> Yiannis
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog