[Solved] org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession…

Error Messages:

org.apache.ibatis.exceptions.PersistenceException: ### Error building SqlSession. ### The error may exist in com/zcat/mybatis/mapper/UserMapper.xml ### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.

 

Note that: The typeAliases in mybatis-config.xml are
is the package name of the entity class
mappers is the package name of the mapping file, so you need to check it carefully.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <properties resource="jdbc.properties"></properties>
    <typeAliases>
        <package name="com.zcat.mybatis.pojo"/>
    </typeAliases>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="${jdbc.driver}"/>
                <property name="url" value="${jdbc.url}"/>
                <property name="username" value="${jdbc.username}"/>
                <property name="password" value="${jdbc.password}"/>
            </dataSource>
        </environment>
    </environments>
    <mappers>
        <package name="com.zcat.mybatis.mapper"/>
    </mappers>
</configuration>

Check the creation of the mapping file. It is different from creating the package. Instead of clicking
, it is/XX/XX

Open in terminal check whether the directory structure generated during creation is correct


Read More: