user2413093
user2413093

Reputation: 1

org.dozer.MappingException: No read or write method found for field

i have one source pojo class inside which it is referring another pojo class and it is in chain and i m getting the above error.

my code is

List myMappingFiles = new ArrayList();
             myMappingFiles.add("dozerMapping.xml");
            // myMappingFiles.add("someOtherDozerBeanMappings.xml");
             DozerBeanMapper mapper = new DozerBeanMapper();
             mapper.setMappingFiles(myMappingFiles);
             mapper.map(gsrlObject,temp, "a");

my dozermapping.xml file is

<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://dozer.sourceforge.net"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://dozer.sourceforge.net http://dozer.sourceforge.net/schema/beanmapping.xsd">
<mapping map-id="a"> 
    <class-a>com.dnb.dsc.ihx.bom.GSRL</class-a>
    <class-b>com.ihx.model.Subj</class-b>   
    <field>
    <a>gsrlObject.GSRLMSGSRQV1a.SUBJUPDTRNRQList[0].SUBJUPDRQList[0].INVTDATAList[0].PAYLHDR.SUBJID</a>
    <b>subjId</b>
    </field> 
  </mapping>  
  </mappings>

any help regarding this

thanks

Upvotes: 0

Views: 3967

Answers (2)

shashi
shashi

Reputation: 400

It means the dozerMapping.xml attributes has been Mismatched or the attribute is not present in the entity class.

Upvotes: 1

M21B8
M21B8

Reputation: 1887

So, Dozer can't map your source path into a method:

gsrlObject.GSRLMSGSRQV1a.SUBJUPDTRNRQList[0].SUBJUPDRQList[0].INVTDATAList[0].P‌​AYLHDR.SUBJID

Without seeing the full structure of all the objects its hard to say which part if causing the problem, but at a guess, i'm going to say: gsrlObject is an instance of the the GSRL class, in which case take this one out and it may work. Try adding each part of the source path in 1 piece at a time to see which part of the mapping is causing the problem.

Upvotes: 0

Related Questions