1. 找不到mapper映射文件异常:Invalid bound statement (not found)
eg: Invalid bound statement (not found): cn.wz.ssm.mapper.ItemMapper.selectByExampleWithBLO
解:此时需要在pom.xml文件中添加配置节点代码,如果不配置,mybatis的mapper.xml文件都会被漏掉。
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<!-- 此配置不可缺,否则mybatis的Mapper.xml将会丢失 -->
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!--指定资源的位置-->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
2. 注意 classspath: 与 classpath*:的区别:
classpath:只会到你指定的class路径中查找找文件;
classpath*:不仅包含class路径,还包括jar文件中(class路径)进行查找.
例: 1.在web.xml中定义:classpath*:META-INF/spring/application-*.xml
那么在META-INF/spring这个文件夹底下的所有application-*.xml都会被加载到上下文中
(包括META-INF/spring application-*.xml,META-INF/spring子文件夹的application-*.xml以及jar中的 application-*.xml)
2. 如果web.xml中定义是:classpath:META-INF/spring/application-context.xml
那么只有META-INF/spring底下的application-*.xml会被加载到上下文中
3.pom.xml中的Java ee 包 需要和jdk对应,activation与java ee 版本对应
<!-- java ee包 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- java ee包 end-->
4.需要在pom.xml 中配置maven 编译插件 的版本以及启动的jdk版本
<!--maven 配置编译插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.8</source><!--jdk版本-->
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
<!--maven 配置编译插件 end-->
可参考 https://blog.csdn.net/u013412066/article/details/51967602
5.IDEA tomcat启动错误可参考三个地方