[geotk] CSW client : unmarshalling issue

Guilhem guilhem.legal at geomatys.fr
Tue May 10 11:24:57 EDT 2011


Hello,

I guess you change a little bit your code after the first error (the 
line 111 is an instanceof).
You probably fix you problem by adding these lines after unmarshalling 
an Object :

if (response instanceOf JAXBElement) {
    response = ((JAXBElement)response).getValue();
}

Guilhem Legal.

Le 10/05/2011 17:09, Damiano ALBANI a écrit :
> On 05/10/2011 04:52 PM, Martin Desruisseaux wrote:
>> Could you post the full stack trace that you get please?
>
> Well, all I get is :
>
> Exception in thread "main" java.lang.ClassCastException: 
> javax.xml.bind.JAXBElement cannot be cast to 
> org.geotoolkit.csw.xml.GetRecordsResponse
>     at TestCSW.getRecords(TestCSW.java:111)
>     at TestCSW.main(TestCSW.java:45)
>
> But, I don't think that this exception is important in itself.
> It's more like a symptom of the inability to properly unmarshall a 
> GetRecordsResponse.
> The type of the object returned by the unmarshaller is JAXBElement, 
> instead of GetRecordsResponse.
> That's why it throws an exception when I try to cast the object.
> So I think the question is : "why does the unmarshaller returns a raw 
> JAXBElement ?" Whereas it works just fine with a Capabilities object.
>
> Regards,
>



More information about the Geotoolkit mailing list