[英]Selenium - Exception in thread “main” java.lang.NoClassDefFoundError: org/reactivestreams/Publisher
I am creating a Maven project for Selenium in eclipse.我正在为 eclipse 中的 Selenium 创建一个 Maven 项目。 Don't know why it threw log4j error (It didn't used to earlier, before upgrading Eclipse).
不知道为什么它会抛出 log4j 错误(在升级 Eclipse 之前不习惯)。 The error is as follows -
错误如下 -
I have already added "log4j.properties" file under src/main/resources as -
我已经在 src/main/resources 下添加了“log4j.properties”文件 -
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
Also added dependency as following in POM.xml -在 POM.xml 中还添加了如下依赖项 -
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.26</version>
</dependency>
Artifacts used -使用的神器——
Eclipse - Version: 2020-06 (4.16.0) Eclipse - 版本:2020-06 (4.16.0)
Maven artifact id - maven-archetype-quickstart - v1.4 Maven 工件 ID - maven-archetype-quickstart - v1.4
Selenium version - 3.141.59 Selenium 版本 - 3.141.59
The error is not related to log4j
.该错误与
log4j
。 The error is for org.reactivestreams.Publisher
.错误是针对
org.reactivestreams.Publisher
的。 Add the following Maven dependency to get it:添加如下 Maven 依赖即可获取:
<!-- https://mvnrepository.com/artifact/org.reactivestreams/reactive-streams -->
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
<version>1.0.3</version>
</dependency>
Make sure to update the project after adding the dependency.确保在添加依赖项后更新项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.