Java.lang.IllegalStateException:No Typehandler found for mapping XXX

Source: Internet
Author: User

Foreword: Today encountered this problem, just began to feel very easy to solve, after all, can locate the problem of the file and corresponding fields, according to the past experience can also be judged that the field mapping type mismatch problems, later found a half-day or did not find the source of the problem, from the online Baidu, Nor did I see a satisfactory analysis and a similar description of my situation. So, make up your mind, take a deep breath, then calm down and have a good fun.

The following is my analysis process, here to provide analysis of the main ideas, hope that in the future in the face of similar problems can be immediately positioned to solve the problem.

1: Part of the exception information, as shown below, as always, first look carefully, according to the exception of the tips can basically locate the problem in that file, that field or some small atmosphere, as shown below

caused by:org.springframework.core.NestedIOException:Failed to parse mapping resource: ' File [D:\workspace\XXX\target \ape-web-0.0.1-snapshot\web-inf\classes\mappers\Sortcenterroutemapper.xml]‘; Nested exception is Org.apache.ibatis.builder.BuilderException:Error parsing Mapper XML. Cause:java.lang.IllegalStateException:No Typehandler found for mapping movementname
At Org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory (sqlsessionfactorybean.java:466)
At Org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet (sqlsessionfactorybean.java:340)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1479)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1419)
... More
caused By:org.apache.ibatis.builder.BuilderException:Error parsing Mapper XML. Cause:java.lang.IllegalStateException:No Typehandler found for mapping movementname
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement (xmlmapperbuilder.java:117)
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.parse (xmlmapperbuilder.java:89)
At Org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory (sqlsessionfactorybean.java:464)
... More
caused By:java.lang.IllegalStateException:No Typehandler found for mapping movementname
At Org.apache.ibatis.mapping.resultmapping$builder.validate (resultmapping.java:147)
At Org.apache.ibatis.mapping.resultmapping$builder.build (resultmapping.java:136)
At Org.apache.ibatis.builder.MapperBuilderAssistant.assembleResultMapping (mapperbuilderassistant.java:426)
At Org.apache.ibatis.builder.MapperBuilderAssistant.buildResultMapping (mapperbuilderassistant.java:222)
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext (xmlmapperbuilder.java:371)
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement (xmlmapperbuilder.java:276)
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement (xmlmapperbuilder.java:248)
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements (xmlmapperbuilder.java:240)
At Org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement (xmlmapperbuilder.java:113)
... More

2: Here is my analysis process

2-1: Locate the case of the problematic file, the field, and then the map, the case of the Map object, the database table field, as follows:

2-2: Originally thought after the above analysis must be able to locate the problem, the result let me puzzled, no problem! I've seen it a few times, and I don't see any problems.

2-3: Then according to my original analysis of the idea of the problem, and then re-analysis again ( sometimes we think it is impossible to have problems, it may be, once the problem is easy to let us collapse of the place ), the following is my re-analysis of the idea, based on the message of the error-"No Typehandler found for mapping"as well as the exception occurred in the nesting position, try to locate the corresponding source code, and then through the debug mode to see what caused the program to throw the wrong, more fortunate, I suddenly positioned the source of the potential problems, As shown below:

2-4: Start the server, into the debug mode, tracking the source error part, analysis of the operation at that time, we see why the program throws an exception, and where there may be problems, to the basic location to the root of the problem, slow down, let the soul keep pace. What makes me wonder is that my field is obviously a string type. Look back at that string of true colors!

2-5: I go, really not what I think of the type of java.lang.String? The problem is to locate, how to solve it will not say! But why is this type? Who modified it? Or did you accidentally cause it? programming is a meticulous work, so still have to bold but cautious some of it!

3: Reference

Http://stackoverflow.com/questions/19273783/no-typehandler-exception-in-mybatis

Java.lang.IllegalStateException:No Typehandler found for mapping XXX

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.