1. First, look at mybatis-config.xml
<mapper resource="com/kuang/dao/TeacherMapper.xml"/>
Be sure to follow the student mapper above. The directory where XML is stored is right
2. Look at mapper.xml
<mapper namespace="com.kuang.dao.StudentMapper">
Be sure to match the directory stored in the student mapper above
3. If there is Chinese in the comments, check whether UTF-8 in the two XML is changed to uft8
<?xml version="1.0" encoding="UTF8" ?>
4. Maven resource export problem
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build>
5. Check whether mapper and mapper.xml are in the same directory under the target directory, and then check whether there are any extra or duplicate. If so, delete those that do not correspond to the SRC directory above.
Summary:
The directories of SRC, test and target should be consistent!!!
Read More:
- JDK upgrade 17 project reports an error java.lang.reflect.inaccessibleobjectexception
- Spock + powermock simulation static method reports an error java.lang.classcastexception
- Mybatis exception error setting driver on unpoleddatasource. Cause: java.lang.ClassNotFoundException :
- Mybatis error,There is no getter for property named ‘xx’ in ‘class java.lang.String The solution
- About the error querying database. Cause: java.lang.nullpointerexception reported in mybatis
- Mybatis integrates Oracle query and reports an error in the datetime type field
- java.lang.NoSuchMethodError: org.json.JSONObject.put(Java/lang/String; Java/util/Collection;) “209151;”
- Error in idea compilation: java.lang.OutOfMemoryError Java heap space and java.lang.StackOverflowError
- Mybatis uses step-by-step lazy loading to cause abnormal JSON conversion. The interface 500 reports an error
- java.lang.IllegalArgumentException: Address 127.0.0.1:5672:5672 seems to contain an unquoted IPv6
- Java uses ZipFile to decompress the zip file and runs normally under Windows. Linux reports an error
- When Dbeaver starts on Mac, it reports an error: “fail to create java virtual machine”
- Zookeeper starts the client and reports an error: java.net.connectexception: connection rejected
- The echots in Vue reports an error. After obtaining the DOM element, the chart can be displayed. The console still reports an error
- Hadoop reports an error. Cannot access scala.serializable and python MapReduce reports an error
- Lamdba in the studio part reports an error. Observe lamdba reports an error but can run
- HTML method IE8 reports an error, IE8 jQuery Ajax obtains static resources reports an error, typeerror denies access
- The file server reports an error of 413, and the file uploaded by nginx reports an error of 413 request entity too large
- Eclipse:An error has occurred. See error log for more details. java.lang.NullPointerException
- build.gradle Warming: cannot be applied to ‘(groovy.lang.Closure)’/'(java.lang.String)’