Selenium – Exception in thread "main" java.lang.NoClassDefFoundError: org/reactivestreams/Publisher

huangapple go评论85阅读模式
英文:

Selenium - Exception in thread "main" java.lang.NoClassDefFoundError: org/reactivestreams/Publisher

问题

我正在Eclipse中为Selenium创建一个Maven项目。不知道为什么它抛出了log4j错误(在升级Eclipse之前以前没有出现过)。错误信息如下 -

我已经在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

同时,在POM.xml中添加了以下依赖 -

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.26</version>
</dependency>

使用的工具和版本 -

Eclipse - 版本:2020-06(4.16.0)

Maven artifact id - maven-archetype-quickstart - v1.4

Selenium版本 - 3.141.59

英文:

I am creating a Maven project for Selenium in eclipse. Don't know why it threw log4j error (It didn't used to earlier, before upgrading Eclipse). The error is as follows -

Selenium – Exception in thread "main" java.lang.NoClassDefFoundError: org/reactivestreams/Publisher I have already added "log4j.properties" file under src/main/resources as -

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 -

    &lt;dependency&gt;
		&lt;groupId&gt;org.slf4j&lt;/groupId&gt;
		&lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
		&lt;version&gt;1.7.26&lt;/version&gt;
	&lt;/dependency&gt;

Artifacts used -

Eclipse - Version: 2020-06 (4.16.0)

Maven artifact id - maven-archetype-quickstart - v1.4

Selenium version - 3.141.59

答案1

得分: 2

错误与 log4j 无关。错误是关于 org.reactivestreams.Publisher 的。添加以下 Maven 依赖以获取它:

<!-- https://mvnrepository.com/artifact/org.reactivestreams/reactive-streams -->
<dependency>
    <groupId>org.reactivestreams</groupId>
    <artifactId>reactive-streams</artifactId>
    <version>1.0.3</version>
</dependency>

在添加依赖后,确保更新项目。

英文:

The error is not related to log4j. The error is for org.reactivestreams.Publisher. Add the following Maven dependency to get it:

&lt;!-- https://mvnrepository.com/artifact/org.reactivestreams/reactive-streams --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;org.reactivestreams&lt;/groupId&gt;
    &lt;artifactId&gt;reactive-streams&lt;/artifactId&gt;
    &lt;version&gt;1.0.3&lt;/version&gt;
&lt;/dependency&gt;

Make sure to update the project after adding the dependency.

huangapple
  • 本文由 发表于 2020年8月17日 01:32:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/63440014.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定