ExecutorService
ExecutorService

Reputation: 43

DataStax Cassandra cannot find Logback-Classic

I am currently trying out the gigantic key-value store Cassandra in combination with a few other libraries such as Akka. After setting up a Cluster and connecting to a keyspace:

val cluster = Cluster.builder().addContactPoint("127.0.0.1").build()
self ! AddKeySpaceSession(keySpace, cluster.connect(keySpace))

I get the infamous "can't find the StaticLoggerBinder" warning message:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.

Now usually, of course, you would simply place one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path. This is what I have done as is evident here:

libraryDependencies ++= {
  val akkaVersion = "2.5.8"
  val akkaDeps = Seq(
    "com.typesafe.akka" %% "akka-actor" % akkaVersion,
    "com.typesafe.akka" %% "akka-cluster" % akkaVersion,
    "com.typesafe.akka" %% "akka-testkit" % akkaVersion
  )

  val logbackVersion = "1.2.3"
  val loggingDeps = Seq(
    "ch.qos.logback" % "logback-classic" % logbackVersion % Test
  )

  val cassandraDriverVersion = "3.3.2"
  val cassandraDeps = Seq(
    "com.datastax.cassandra" % "cassandra-driver-core" % cassandraDriverVersion
  )

Though the issue remains and Cassandra is actually the only one that complains about it.

Upvotes: 0

Views: 119

Answers (1)

Szymon Jednac
Szymon Jednac

Reputation: 3007

The problem might be related to the scope of the logback-classic dependency. Instead of putting it in the Test scope:

"ch.qos.logback" % "logback-classic" % logbackVersion % Test

Try putting it under the default scope:

"ch.qos.logback" % "logback-classic" % logbackVersion

Upvotes: 1

Related Questions