This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XML Mapping with Collection in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML Mapping with Collection in java" Watch "XML Mapping with Collection in java" New topic
Author

XML Mapping with Collection in java

Geet Chaudhary
Greenhorn

Joined: Feb 15, 2010
Posts: 11

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

Joined: Mar 10, 2008
Posts: 1753
    
    7

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.

Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML Mapping with Collection in java
 
Similar Threads
Getting No suitable driver error using hibernate.
Spriing : Context initialization failing due to inner class usage
jibx binding Error: Nonstatic field name not found in
Spring related errors on Tomcat console on deploying WAR in 'webapps' folder
WLS 10.3 + hibernate: DuplicateMappingException while deploying the war file