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

北城以北 提交于 2019-12-11 04:02:30

问题


org.dozer.MappingException: No read or write method found for field (tarShipMethodCode.lmCourier.courierName) in class (class com.essilor.ong.domain.inventory.POLocationEntity)

I am getting this error when i build my war file and try to run Tomcat. I am using JPA and dozer mapping. Can anyone tell me how to fix it?


回答1:


Check your Beans and your Dozer-Mapping-File.

There are multiple (more or less common) errors possible:

  • Typo in the mappingfile. Check the package and field names in your POLocationEntity, does it have a field named tarShipMethodCode, and does this have an ImCourier field, and this a courierName field?

  • Lack of getters / setters. Again check the beans, Dozer usually expects getFieldName and setFieldName methods, unless you specified others (which I do not assume, maybe post your mapping file).

  • Narrow the problem down: Is this the only field that is not working? Or is this field not specified at all? Dozer tends to try to map-by-name fields that do not have corresponding entries in the mapping file, which could lead to unexpected errors.

tl;dr

With some more information (mapping xml, bean code) this would be easier to analize, but the above pointers are the ones that solve these kinds of problems in my experience.



来源:https://stackoverflow.com/questions/14783315/org-dozer-mappingexception-no-read-or-write-method-found-for-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!