[英]ClassNotFoundException when adding slf4j to Akka
以下是我將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]]
.....
有關如何解決此問題的任何想法?
可以通過將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-actor
和akka-slf4j
具有相同的版本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.