GetterSetterPropertyDescriptor.writeDeepDestinationValue NullpointerException

440 views
Skip to first unread message

DozerUser

unread,
Feb 14, 2013, 4:46:29 PM2/14/13
to dozer-...@googlegroups.com
Hi all,
I am new to Dozer  and trying to do the following mapping but getting the below error. Can some one please help me understand what I am doing wrong and what should be the right approach.

Thanks.

Class structure -
Source = SourceRequest-> Order -> <List>LineItem
Dest = DestRequest - >Doc -> LnItms > <List>LnItm

excerpts from my beanMappping.xml -
<mapping type="one-way" wildcard="false" map-null="false" map-empty-string="false">
<class-a>sourcePackage.Order</class-a>
<class-b>destPackage.Doc</class-b>
<field>
<a>currency</a>
<b>currn</b>
</field>
<field>
<a>lineItems</a>
<b>lnItms.lnItm</b>
<a-hint>sourcePackage.LineItem</a-hint> 
<b-hint>destPackage.LnItm</b-hint>
</field>
</mapping>

<mapping type="one-way" wildcard="false" map-null="false" map-empty-string="false">
<class-a>sourcePackage.LineItem</class-a>
<class-b>destPackage.LnItm</class-b>
<field>
<a>id</a>
<b>lnItmId</b>
</field>
<field>
<a>lineNumber</a>
<b>lnItmNm</b>
</field>
</mapping>

I am getting the following exception -
1895 [main] DEBUG org.dozer.fieldmap.FieldMap  - Getting ready to invoke write method on the destination object. Dest Obj: Doc, Dest value: [destPackage.LnItm@1315415]
1895 [main] ERROR org.dozer.MappingProcessor  - Field mapping error -->
  MapId: null
  Type: null
  Source parent class: sourcePackage.Order
  Source field name: lineItems
  Source field type: class java.util.ArrayList
  Source field value: [sourcePackage.model.LineItem@1b6634c]
  Dest parent class: destPackage.Doc
  Dest field name: lnItms.lnItm
  Dest field type: java.util.List
java.lang.NullPointerException
at org.dozer.util.ReflectionUtils.invoke(ReflectionUtils.java:286)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue(GetterSetterPropertyDescriptor.java:240)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.setPropertyValue(GetterSetterPropertyDescriptor.java:86)
at org.dozer.fieldmap.FieldMap.writeDestValue(FieldMap.java:94)


DozerUser

unread,
Feb 15, 2013, 9:33:46 AM2/15/13
to dozer-...@googlegroups.com
I was able to resolve the issue. The issue was created due to JAXB generated dest List variable without any setter method. After setting is-accesible the issue got resolved. The other option would be to generate JAXB classes with this plugin. http://confluence.highsource.org/display/J2B/Setters+Plugin
Reply all
Reply to author
Forward
0 new messages