What version of Tomcat are you using ? I think I'd like to be able to
replay this (if possible). Having said that, the error message simply
does not make sense unless you've got another mapping file that -
coincidently - defines another mapping for Test(Array).
Werner
PS Whatever your reply is, can you please try to set the web app's
ClassLoader on the Unmarshaller (if not the Mapping as well).
pat wrote:
> Hi all,
>
> I realy like to use Castor for xml binding and I've used it in previous
> project, but now I fall in troubles with mapping loading. The problematic
> mapping fragment is:
> <class name="test.TestArray">
> <map-to xml="test_array"/>
> <field name="testArray" type="test.Test" collection="array">
> <bind-xml name="test"/>
> </field>
> </class>
>
> The class is like this:
> public class TestArray {
> private Test[] testArray;
> public Test[] getTestArray() {...}
> public void setTestArray(Test[] testArray) {...}
> }
>
> When I ran this as standalone test from command line everything is fine, but
> when I place it in the web container (Tomcat) application I receive this:
> org.exolab.castor.mapping.MappingException: The return type for method public
> test.Test[] test.ws.TestArray.getTestArray() does not match the declared field
> type java.util.ArrayList
>
> The code I'm using for the mapping loading and the unmarshalling (I need only
> unmarshalling not marshalling) is:
> URL mapURL = TestIt.class.getClassLoader().getResource("test/mapping.xml");
> Mapping mapping = new Mapping();
> mapping.loadMapping(mapURL);
> Unmarshaller unmarshaller = new Unmarshaller(mapping);
> unmarshaller.setIgnoreExtraElements(true);
> unmarshaller.setIgnoreExtraAttributes(true);
> return (TestArray)unmarshaller.unmarshal(inSource);
>
> Can someone help ???
>
> Thanks a lot.
>
> Pat
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email