Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
junit失败,但在通过maven命令行运行时通过_Maven_Junit - Fatal编程技术网

junit失败,但在通过maven命令行运行时通过

junit失败,但在通过maven命令行运行时通过,maven,junit,Maven,Junit,我的junit在使用eclipse运行时失败。但是当我使用maven命令行运行时,它成功了 java.lang.ClassCastException: org.springframework.security.core.authority.GrantedAuthorityImpl cannot be cast to java.lang.Comparable at java.util.TreeMap.compare(Unknown Source) at java.util.Tree

我的
junit
在使用
eclipse
运行时失败。但是当我使用
maven
命令行运行时,它成功了

java.lang.ClassCastException: org.springframework.security.core.authority.GrantedAuthorityImpl cannot be cast to java.lang.Comparable
    at java.util.TreeMap.compare(Unknown Source)
    at java.util.TreeMap.put(Unknown Source)
    at java.util.TreeSet.add(Unknown Source)

当缺少依赖项(jar文件)或类路径/lib文件夹中存在重复项时,这些类型的ClassCastException通常会出现。请检查eclipse运行测试的文件夹中是否有重复/丢失的jar文件。

在我的例子中,这是jre的问题。我从jre7改为jre6(我的项目jre),它成功了。

检查Spring依赖项。我认为这个错误可能是由库冲突引起的。。