java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

简介: java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

下载了最新的JUnit版本,是4.13,结果尝试使用发现总是报java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing这样的错误,

  • 一般的解决方案是,换一个低一点的版本就好了
  • 还有人说,是缺少hamcrest的包。去官网又看了一下,结果发现这样一段话:

junit.jar: Includes the Hamcrest classes. The simple all-in-one solution to get started quickly.Starting with version 4.11, Hamcrest is no longer included in this jar.

junit-dep.jar: Only includes the JUnit classes but not Hamcrest. Lets you use a different Hamcrest version.


注意黑色加下划线的部分。说明4.1.2中没有hamcrest包了


解决方案

  • 换成junit-4.8.jar
  • junit-4.12.jar + hamcrest-core-1.3.jar
目录
相关文章
|
Java Go Nacos
解决Spring Boot与Nacos集成时的类加载问题: java.lang.NoClassDefFoundError: org/springframework/boot/context/prope
解决Spring Boot与Nacos集成时的类加载问题: java.lang.NoClassDefFoundError: org/springframework/boot/context/prope
251 1
|
Apache
java.lang.NoClassDefFoundError: org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream
java.lang.NoClassDefFoundError: org/apache/commons/io/output/UnsynchronizedByteArrayOutputStream
570 0
|
3月前
|
Java 测试技术 Maven
成功解决:nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource
这篇文章介绍了解决Spring框架中出现的`java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource`错误的步骤,指出错误原因是缺少`spring-aop`模块的jar包,并提供了通过Maven依赖或手动添加jar包到项目中的方法来解决这个问题。
成功解决:nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/TargetSource
|
6月前
|
Java
java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/YamlProcessor$StrictMapAppe
java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/YamlProcessor$StrictMapAppe
242 0
|
4月前
|
easyexcel Java Apache
EasyExcel导入的时候报错Caused by: java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/File
EasyExcel导入的时候报错Caused by: java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/File
384 0
|
Java Apache Maven
【异常解决】Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: org/apache/common
【异常解决】Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: org/apache/common
3807 0
|
6月前
|
SpringCloudAlibaba Java Maven
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
【问题篇】Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/
42 2
|
6月前
|
安全 Java 数据库连接
java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/YamlProcessor$StrictMapAppe
java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/YamlProcessor$StrictMapAppe
57 0
|
6月前
|
Java 应用服务中间件
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallablePro
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/request/async/CallablePro 错误处理
98 0
|
6月前
|
Java
Junit4.12报错:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
Junit4.12报错:java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
下一篇
无影云桌面