Can anyone help me resolve this Validation Exception problem?
Even when i am removing the below mentioned mapping element from the mapping
file, it still shows the same exception for same <field>......
Any pointers/suggestions are welcome.
avner21J wrote:
>
> The problematic member variable definition in Java is:
>
> private Map<String, List<com.xyz.Policy>> contextPolicies;
>
> public Map<String, List<com.xyz.Policy>> getContextPolicies() {
> return contextPolicies;
> }
> public void setContextPolicies(Map<String, List<com.xyz.Policy>>
> contextPolicies1) {
> this.contextPolicies = contextPolicies1;
> }
>
> Corresponding mapping is :
>
> <field name="contextPolicies" collection="map">
> <bind-xml name="contextPolicies" node="element">
> <class name="org.exolab.castor.mapping.MapItem">
> <field name="key" type="string"/>
> <field name="value"
> type="com.xyz.Policy" collection="arraylist"/>
> </class>
> </bind-xml>
> </field>
>
> As I mentioned earlier, why I think this is the problem is because when I
> use Inputstream as the mode for Unmarshalling[I send the marshalled xml(
> marshalled by Castor only) as InputStream] it shows problem with this
> mapping saying Validation Exception for multiple value elements (same as
> Castor-1175 bug)
>
>
>
> Werner Guttmann-6 wrote:
>>
>> Hi,
>>
>> what does the Java member definition look like and the corresponding
>> mapping ?
>>
>> Kind Regards
>> Werner Guttmann
>>
>> On 09.03.2011 09:29, avner21J wrote:
>>>
>>> I am using castor-xml-1.3.1 and castor-core-1.3.1
>>>
>>> Please let me know if any solution or any workaround is there?
>>> I would like to do Unmarshalling from a xml file generated through
>>> Castor
>>> Marshaller. Here it is I get the InstantiationException for List even
>>> though
>>> in all my mapping files it has collection attribute as arraylist
>>>
>>> I could see a bug 1175 for Validation Exception while unmarshalling a
>>> Map
>>> having collection as value. Is it resolved in the 1.3.1 version?
>>>
>>> Stack trace :
>>>
>>> org.exolab.castor.xml.MarshalException: Unable to instantiate
>>> java.util.List; {File: [not available]; line: 2; column: 300}
>>> at
>>> org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:794)
>>> at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:760)
>>> at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:626)
>>> at
>>> com.cisco.epm.pdp.cache.CastorPolicyCacheConverter.getObjectFromXML(CastorPolicyCacheConverter.java:107)
>>> at
>>> com.cisco.epm.pdp.cache.CastorPolicyCacheConverter.readPolicyCacheObjetcs(CastorPolicyCacheConverter.java:54)
>>> at com.cisco.epm.pdp.cache.DataLoader.loadFromXML(DataLoader.java:1143)
>>> at com.cisco.epm.pdp.PDPFacade.initialize(PDPFacade.java:1514)
>>> at com.cisco.epm.pdp.PDPFacade.init(PDPFacade.java:1348)
>>> at
>>> com.cisco.epm.pdp.TestMarshallingScopeNode.testScopeNodeShouldbeMarshalled(TestMarshallingScopeNode.java:102)
>>> at
>>> com.cisco.epm.pdp.TestMarshallingScopeNode.main(TestMarshallingScopeNode.java:58)
>>> Caused by: java.lang.InstantiationException: java.util.List
>>> at
>>> org.exolab.castor.xml.UnmarshalHandler.createInstance(UnmarshalHandler.java:2584)
>>> at
>>> org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:2348)
>>> at
>>> org.exolab.castor.xml.UnmarshalHandler.startElement(UnmarshalHandler.java:1436)
>>> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
>>> Source)
>>> at
>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
>>> Source)
>>> at
>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
>>> Source)
>>> at
>>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
>>> Source)
>>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>>> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>>> at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
>>> Source)
>>> at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:748)
>>> ... 8 more
>>> Caused by: java.lang.InstantiationException: java.util.List
>>> at java.lang.Class.newInstance0(Class.java:340)
>>> at java.lang.Class.newInstance(Class.java:308)
>>> at
>>> org.exolab.castor.util.DefaultObjectFactory.createInstance(DefaultObjectFactory.java:107)
>>> at
>>> org.exolab.castor.xml.UnmarshalHandler.createInstance(UnmarshalHandler.java:2579)
>>>
>>>
>>>
>>> avner21J wrote:
>>>>
>>>> I believe you saw the un-updated post.
>>>> I have updated it with the code snippet.
>>>>
>>>>
>>>> Werner Guttmann-6 wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> looks like your mapping XML didn't make it through the various (spam)
>>>>> filters .. ;-).
>>>>>
>>>>> Regards
>>>>> Werner
>>>>>
>>>>> On 08.03.2011 14:54, avner21J wrote:
>>>>>>
>>>>>> I am facing a peculiar problem.
>>>>>> If I use an xml file created by Castor Marshaller, for unmarshalling
>>>>>> by
>>>>>> Castor, it shows InstantiationException for java.util.List
>>>>>> Same thing if I pass as InputStream to Castor Unmarshaller it says
>>>>>> ValidationException: element "value" occurs more than once. (parent
>>>>>> class:
>>>>>> org.exolab.castor.mapping.MapItem)
>>>>>>
>>>>>> I believe the problem is with following mapping element in my file...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Here the Collection for Policy object in the Java file is List.....
>>>>>>
>>>>>> But Marshalling by Castor is working fine.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>
>>
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/UnmarshalException-for-xml-created-by-Castor-Marshaller-tp31097277p31136956.html
Sent from the Castor - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email