MyBatis Error: Error building SqlSession [How to Solve]

MyBatis Error building SqlSession.

The error may exist in SQL Mapper Configuration

Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.ClassNotFoundException

In the configuration file:

<mappers>
    <mapper class="com/base/dao/UserMapper.xml"/>
</mappers>

written as:

<mappers>
    <mapper resource="com/base/dao/UserMapper.xml"/>
</mappers>

If you still can’t find it, you can configure pom.xml

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
        </resource>
    </resources>
</build>

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *