[Solved] Could not find resource com/cth/dao/UserImpl.xml & Single mapping file not found

report errors:

### The error may exist in com/cth/dao/UserImpl.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/cth/dao/UserImpl.xml
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
	at com.cth.domain.User.main(User.java:17)
	……

reason

Because the userimpl.XML file under COM/CTH/Dao/ has not been compiled into the corresponding directory under the target/classes directory, I don’t believe you can find it under the target/classes directory in the project. You can’t find it

Solution:

Method 1: put the files in COM/CTH/Dao directory under resource

Method 2: add the following code to the POM file

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

Similar Posts: