java.lang.IllegalStateException: No typehandler found for property xxx


今天遇到一個很傻逼的問題,在一個功能點的mapper里插入以下代碼后,另一個平行功能點報錯,報錯信息如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'BaseattachBusiness': Unsatisfied dependency expressed through field 'tbBaseAttachService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TbBaseAttachService': Unsatisfied dependency expressed through field 'tbBaseAttachMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tbBaseAttachMapper' defined in file [C:\Users\99043\Desktop\yunong-cloud\yunong-gap-common\target\classes\com\yun\cloud\gap\dao\TbBaseAttachMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\99043\Desktop\yunong-cloud\yunong-gap-common\target\classes\mapper\TbEmployeeTrainingRecordMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.IllegalStateException: No typehandler found for property trainingUrls

一時間把我和我的小伙伴整蒙了,沒辦法我只能硬着頭皮分析
image-20210802170347156

之后根據異常的嵌套關系,我定位到實際引發錯誤的是以下語句:java.lang.IllegalStateException: No typehandler found for property trainingUrls,並且產生bug的文件為[C:\Users\99043\Desktop\yunong-cloud\yunong-gap-common\target\classes\mapper\TbEmployeeTrainingRecordMapper.xml]。發現的確是trainingUrls字段在添加時出現了紕漏:

image-20210802170943740

於是我改為CHAR類型后點擊debug,兩手一攤准備抖jio,卻不想問題並沒有解決:

image-20210802171136779

顯然,盡管我把trainingUrls字段的jdbcType改成了"CHAR",還並不能解決問題,那就肯定是Dto出了問題,果然,修改一下:

image-20210802173141379

問題解決。

image-20210802174723361


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM