Error: Error building SqlSession [How to Solve]

1.

The above error occurred:

Copy the XML file in Dao/mapper to the corresponding location of the test class in the target folder. If it runs successfully, delete it, and follow the steps below. (this XML file may be under other packages)

Comparison before and after copying:

                 

Step ①: ensure that the path of the test class is the same as that of the corresponding class in main.

Step 2: view the XML file of your own resources & lt; mappers> Whether the path in is correct (note that slashes are used instead of dots)

Step ③: check whether the path behind the namespace in the XML file of your Dao/mapper package is correct. (this XML file can be under other packages)

Step ④: in your own POM Add the following code to XML, refresh Maven or restart idea. (because the Maven project contract is greater than the configuration, idea will not load the resource files in the Java source directory into the project.)

<!--Configure resources in build to prevent our resource export from failing -->
<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

II

If it is the above error: change the UTF-8 in your XML file to utf8 and run it again.

Read More: