Class not found: “com.***.Dao.******Test“

Process finished with exit code 1

Class not found: “com.pxy.dao.GradeDaoTest”

首先来贴一下我的在用上一篇博客中插入时遇到的错误:
Class not found: “com.***.Dao.******Test“
出现这个问题,是因为在target中找不到我们的com.pxy.dao.GradeDaoTest文件,所以我百度了好久好久:
Class not found: “com.***.Dao.******Test“
Class not found: “com.***.Dao.******Test“
勾上后我们再次运行Test发现又出现了一样的问题
Class not found: “com.***.Dao.******Test“
但是在我们的目录中是可以看到有这个类的class文件的:
Class not found: “com.***.Dao.******Test“
而且最过分的是我查看我的数据库,发现数据库中的数据已经插入成功了:
Class not found: “com.***.Dao.******Test“
??????
我抱着侥幸的心态又运行了一下:
Class not found: “com.***.Dao.******Test“
错变了
我想可能是库中存在这个数据的原因,我又将代码中的字段改了一下,将55——>56
Class not found: “com.***.Dao.******Test“
运行:
Class not found: “com.***.Dao.******Test“
这里发现是主键重复了,我查看我的数据库发现56已经插入进去了
Class not found: “com.***.Dao.******Test“
再次经过百度查询总结了很多,简单来说就是我运行这个测试类的时候,maven帮我跑了一遍,我再跑他的时候就不行了,因为库中已经存在的同主键的数据了,于是就插入不进去了,解决方法是:
Class not found: “com.***.Dao.******Test“
将这个勾上,跳过Test的执行,我再讲字段改成57:
Class not found: “com.***.Dao.******Test“
兄弟们,好起来了,开心!