错误状态码:HTTP Status 500 - Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.wqc.dao.FunctionMapper.selectByExample

解决方法是在pom文件里写入相关参数,把mybatis的xml文件编译进去,eclipse和maven会自动编译进去,而idea运行tomcat不会,可以看下target文件夹看下有没有少了什么文件
在pom文件里导入下面的插件就可以
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-xmls</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
本文介绍了解决MyBatis中XML映射文件未被正确编译导致的HTTP 500错误的方法。通过在Maven的pom.xml文件中配置资源和插件,确保XML文件能够被正确地包含到项目中,从而避免运行时出现BindingException异常。
1654

被折叠的 条评论
为什么被折叠?



