Reputation: 1412
I have a working akka-http
application. Now I tried adding logging via slf4j and logback and my application crashes.
build.sbt
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-http" % "10.0.7",
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.akka" %% "akka-slf4j" % "2.5.2"
)
application.conf
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "DEBUG"
logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
}
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
error:
Detected java.lang.NoSuchMethodError error, which MAY be caused by incompatible Akka versions on the classpath. Please note that a given Akka version MUST be the same across all modules of Akka that you are using, e.g. if you use akka-actor [2.5.2 (resolved from current classpath)] all other core Akka modules MUST be of the same version. External projects like Alpakka, Persistence plugins or Akka HTTP etc. have their own version numbers - please make sure you're using a compatible set of libraries.
Uncaught error from thread [my-system-akka.actor.default-dispatcher-6] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[my-system] java.lang.NoSuchMethodError: akka.actor.ActorCell.addFunctionRef(Lscala/Function2;)Lakka/actor/FunctionRef;
According to the message, it's a compatibility issue. How do I find out which versions of akka-http
and akka-slf4j
are compatible (except trying out)?
On a side note, since it's a similar problem: I want to add akka-stream
. However, using the newest versions of akka-http
and akka-stream
gives me eviction warnings in sbt. Same quesion as above: how do I find out which versions to use?
Upvotes: 0
Views: 438
Reputation: 1342
Unfortunately akka-http
is versioned separately from the rest of akka
and the newest version of it does not necessarily use the newest version of akka
. In case of akka-http
version 10.0.7
the compatible akka
version is 2.4.18
. You can see it here. This means that you need to drop to that version in akka-slf4j
dependency to run the application without problems.
Upvotes: 2