java.lang.IllegalStateException: No typehandler found for mapping XXX
前言:今天遇到了这个问题,刚开始觉得很容易解决的,毕竟能定位到出问题的文件和对应的字段,根据以往的经验也可以判断出是字段映射类型不匹配的问题,后来找了半天还是没找到问题的根源,从网上百度,也没看到令人满意的分析以及和我情况类似的描述。于是,下定决心,先深呼吸,然后冷静下来好好玩一下。
如下是我的分析过程,这里以提供分析的思路为主,希望以后在遇到类似的问题能一下子定位到,解决掉。
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\Feishu\Vue\问答调研\-system\target\classes\mapper\system\SysProjectMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\Feishu\Ruoyi-Vue\问答调研\ruoyi-system\target\classes\mapper\system\SysProjectMapper.xml]'. Cause: java.lang.IllegalStateException: No typehandler found for property projectEndDate
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:523)
at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:380)
at org.mybatis.spring.SqlSessionFactoryBean.getObject(SqlSessionFactoryBean.java:547)
at com.ruoyi.framework.config.MyBatisConfig.sqlSessionFactory(MyBatisConfig.java:106)
at com.ruoyi.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$72ad0ab9.CGLIB$sqlSessionFactory$0(<generated>)
at com.ruoyi.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$72ad0ab9$$FastClassBySpringCGLIB$$702445a7.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at com.ruoyi.framework.config.MyBatisConfig$$EnhancerBySpringCGLIB$$72ad0ab9.sqlSessionFactory(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 62 common frames omitted
如下图分析
![在这里插入图片描述](https://img-blog.csdnimg.cn/202012140110576.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTQ4NjAxMQ==,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201214011225288.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTQ4NjAxMQ==,size_16,color_FFFFFF,t_70)
原本以为经过上边图对比就能够看出来问题所在结果还是解决不了让我疑惑不解!!!
![在这里插入图片描述](https://img-blog.csdnimg.cn/20201214011433664.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTQ4NjAxMQ==,size_16,color_FFFFFF,t_70)
经过排查发现引用错类型,记录下