org.dozer.MappingException:找不到字段的读取或写入方法 [英] org.dozer.MappingException: No read or write method found for field

查看:1426
本文介绍了org.dozer.MappingException:找不到字段的读取或写入方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

org.dozer.MappingException:找不到字段的读取或写入方法 (class(class)中的(tarShipMethodCode.lmCourier.courierName) com.essilor.ong.domain.inventory.POLocationEntity)

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

在构建我的war文件并尝试运行Tomcat时出现此错误. 我正在使用JPA和推土机映射. 谁能告诉我如何解决?

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?

推荐答案

检查您的Bean和Dozer映射文件.

Check your Beans and your Dozer-Mapping-File.

可能存在多个(或多或少常见)错误:

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

    映射文件中的
  • Typo.检查您的POLocationEntity中的包和字段名称,它是否有一个名为tarShipMethodCode的字段,并且是否有一个ImCourier字段,以及一个courierName字段?

  • 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?

缺少吸气剂/吸气剂.再次检查bean,Dozer通常希望使用getFieldName和setFieldName方法,除非您指定了其他方法(我不认为这些方法可能会发布您的映射文件).

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).

缩小问题范围:这是唯一不起作用的字段吗?还是根本不指定此字段? Dozer倾向于尝试按名称映射在映射文件中没有相应条目的字段,这可能会导致意外错误.

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

有了更多信息(映射xml,bean代码),这将更易于分析,但是上述指针是根据我的经验解决了这类问题的指针.

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.

这篇关于org.dozer.MappingException:找不到字段的读取或写入方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆