在b站上跟着老师做了一个小型ssm项目,在测试验证功能的时候遇到了这个bug,改了五六个小时,最后根据日志文件修改完成了,共遇到两个错误。
1,pagehelper的版本低了,导致找不到com.github.pagehelper.PageInterceptor这个类,于是将pagehelper的版本升级到5.1.2,第一个问题解决。
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.2</version> </dependency>
2,在使用逆向工程生成dao和entity两个包时xml文件中的配置如下:
<table schema="" tableName="admin_table"></table>
<table schema="" tableName="goods_table"></table>
<table schema="" tableName="goodstype_table"></table>
数据库名没有指定,默认所有数据库,而我的所有数据库中有两个goods_table表,于是就在一个goodstable的mapper.xml文件中生成了两个id为BaseResultMap的resultmap,发生冲突。
问题总结:日志文件才是最好用的查错工具。