【问题标题】:ClassNotFoundException when adding slf4j to Akka将 slf4j 添加到 Akka 时出现 ClassNotFoundException
【发布时间】:2019-05-07 05:01:32
【问题描述】:

以下是我将 slf4j 添加到我的 Akka 项目时得到的错误跟踪。

.....
[DEBUG] [05/07/2019 10:12:00.959] [main] [EventStream] StandardOutLogger started
error while starting up loggers
akka.ConfigurationException: Logger specified in config can't be loaded [akka.event.slf4j.Slf4jLogger] due to [java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLogger]
.....
Caused by: java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLogger
.....
Exception in thread "main" akka.ConfigurationException: Could not start logger due to [akka.ConfigurationException: Logger specified in config can't be loaded [akka.event.slf4j.Slf4jLogger] due to [java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLogger]]
.....

关于如何解决此问题的任何想法?

【问题讨论】:

    标签: java logging akka slf4j


    【解决方案1】:

    可以通过将akka-slf4j 依赖项添加到您的 Akka 项目来解决此问题。

        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-actor_2.12</artifactId>
            <version>2.5.22</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-slf4j_2.12</artifactId>
            <version>2.5.22</version>
        </dependency>
    

    注意:确保您的 akka-actorakka-slf4j 具有相同的 版本。

    【讨论】:

      猜你喜欢
      • 2017-11-20
      • 1970-01-01
      • 2018-09-26
      • 1970-01-01
      • 2011-08-28
      • 1970-01-01
      • 1970-01-01
      • 2016-10-28
      • 2019-09-08
      相关资源
      最近更新 更多