Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Mapping with Collection in java

 
Geet Chaudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have an attribute in my java class named : private List marketPrograms

I need to map this in my xml file.

Below are the statement , we are using to map it

<field name="marketProgram" type="string" collection="arraylist">
<bind-xml name="marketProgram" node="element" location="marketPrograms"/>
</field>


But it is giving error:

If in case we use {collection="collection"} instead of {collection="arraylist"} then also its giving me error


Below is the Error Message:

org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'xmlContext' defined in resource loaded through SAX InputSource: Invocati
on of init method failed; nested exception is org.exolab.castor.mapping.MappingE
xception: The method getMarketProgram/isMarketProgram in class com.pcc.services.
vo.search.criteria.AttributesSearchVO accepting/returning object of type class j
ava.util.ArrayList was not found
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1174)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:425)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:248)
Truncated. see log file for complete stacktrace

org.exolab.castor.mapping.MappingException: The method getMarketProgram/isMarket
Program in class com.pcc.services.vo.search.criteria.AttributesSearchVO acceptin
g/returning object of type class java.util.ArrayList was not found
at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldHan
dler(AbstractMappingLoader.java:776)
at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldDes
c(AbstractMappingLoader.java:548)
at org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(XMLMappingLoad
er.java:461)
at org.exolab.castor.mapping.loader.AbstractMappingLoader.createFieldDes
criptors(AbstractMappingLoader.java:408)
at org.exolab.castor.xml.XMLMappingLoader.createClassDescriptor(XMLMappi
ngLoader.java:231)


Please help me out if someone have any idea in this.
Thanks
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method getMarketProgram/isMarketProgram in class com.pcc.services.
vo.search.criteria.AttributesSearchVO accepting/returning object of type class j
ava.util.ArrayList was not found.


Presumably that means that the AttributesSearchVO class does not provide a JavaBean compliant accessor for the marketPrograms member variable.
Or maybe it does, but Castor can't locate it because it's looking for a JavaBean accessor for something called marketProgram.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic