0

While this does seem to be a common issue, I have looked and tried many fixes for sbt and this dependency issue without success.

Setup is a simple query to hive from scala using the run command within IntelliJ. The command is using JDBC to connect to hive.

  val sql = s"select * from ${tableName} where user_id = '1'";
  val res = stmt.executeQuery(sql);

Here are my Imports:

import java.sql.{SQLException, Connection, DriverManager, ResultSet, Statement}
import scala.collection.mutable.ArrayBuffer
//import scala.io.{BufferedSource, Source}
import scala.language.postfixOps
//import scala.util.matching.Regex
//import java.sql.ResultSetMetaData

The sbt file is as follows:

ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "2.13.8"


lazy val scriptClasspath = Seq("*")

lazy val root = (project in file("."))
  .settings(
    name := "RevProject_1",
    libraryDependencies += "org.apache.hive" % "hive-jdbc" % "3.1.2",
  )

Now for the errors as displayed in IntelliJ Terminal:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/samps/AppData/Local/Coursier/Cache/v1/https/repo1.maven.org/maven2/ch/qos/logback/logback-classic/1.0.9/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/samps/AppData/Local/Coursier/Cache/v1/https/repo1.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/samps/AppData/Local/Coursier/Cache/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
09:58:04.460 [main] DEBUG org.apache.hive.jdbc.Utils - Resolved authority: localhost:10000
09:58:04.553 [main] DEBUG o.a.thrift.transport.TSaslTransport - opening transport org.apache.thrift.transport.TSaslClientTransport@6279cee3
09:58:04.556 [main] DEBUG o.a.t.transport.TSaslClientTransport - Sending mechanism name PLAIN and initial response of length 10
09:58:04.559 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: Writing message with status START and payload length 5
09:58:04.559 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: Writing message with status COMPLETE and payload length 10
09:58:04.559 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: Start message handled
09:58:04.559 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: Main negotiation loop complete
09:58:04.559 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: SASL Client receiving last message
09:58:04.673 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: Received message with status COMPLETE and payload length 0
09:58:04.697 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 147
09:58:04.831 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 169
09:58:04.920 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 161
09:58:05.466 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 109
09:58:05.471 [main] DEBUG o.a.h.j.l.InPlaceUpdateStream$EventNotifier - progress bar is complete
09:58:05.474 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 104
09:58:05.506 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 144
09:58:05.515 [main] DEBUG o.a.h.j.l.InPlaceUpdateStream$EventNotifier - progress bar is complete
09:58:05.520 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 102
09:58:05.522 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 386
List(user_info.user_id, user_info.age, user_info.gender, user_info.occupation, user_info.zip_code)
________________________________
09:58:05.715 [main] DEBUG o.a.h.j.l.InPlaceUpdateStream$EventNotifier - progress bar is complete
09:58:05.715 [main] DEBUG o.a.h.j.l.InPlaceUpdateStream$EventNotifier - progress bar is complete
09:58:05.718 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 112
09:58:05.747 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 211
09:58:05.794 [main] DEBUG o.a.h.j.l.InPlaceUpdateStream$EventNotifier - progress bar is complete
09:58:05.794 [main] DEBUG o.a.h.j.l.InPlaceUpdateStream$EventNotifier - progress bar is complete
09:58:05.794 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 112
09:58:05.796 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 180
List(1, 24, M, technician, 85711)
09:58:05.800 [main] DEBUG o.a.thrift.transport.TSaslTransport - writing data length: 83
09:58:05.835 [main] DEBUG o.a.thrift.transport.TSaslTransport - CLIENT: reading data length: 40

And if done through CLI in Windows 10:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/samps/IdeaProjects/RevProject_1/target/bg-jobs/sbt_c6e37a9e/target/0d623873/496b60b1/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/samps/IdeaProjects/RevProject_1/target/bg-jobs/sbt_c6e37a9e/target/ca4cb403/8c0ceb42/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/samps/IdeaProjects/RevProject_1/target/bg-jobs/sbt_c6e37a9e/target/a36b2584/d39b8363/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.
List(user_info.user_id, user_info.age, user_info.gender, user_info.occupation, user_info.zip_code)
________________________________
List(1, 24, M, technician, 85711)

I have tried the following:

Excluding the dependency in sbt using:

libraryDependencies += "group" % "artifactId/name" % "version" exclude("group", "artifactId/name")
libraryDependencies += "org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.10.0" exclude("org.apache.logging.log4j", "log4j-slf4j-impl")

I am not sure if there are any errors in the previous code. If so let me know. I have attempted to locate a POM.xml and an IVY file in my project. Unfortunately I have been unable to locate them. I have read through many of the answers for this issue within this site and run into the scenario where it is not applicable due to using Scala/sbt or lack of direction for someone of my skill level to learn how to properly implement the fix.

to further view the project files you can see them at: https://github.com/sampss/RevProject_1

Any assistance with resolving this issue is greatly appreciated.

veryreverie
  • 2,871
  • 2
  • 13
  • 26
  • Note that this is not an error per se. It's just an information that multiple libraries that do the same job (being a logging implementation) are included in your depdencies. – Gaël J Apr 08 '22 at 18:32
  • Use `excludeDependencies +=` syntax. Check out SBT documentation. – Gaël J Apr 08 '22 at 18:34
  • I have read the SBT documentation. Unfortunately it tends to lack complete documentation for implementation. I have looked at the syntax but am unable to figure out exactly how to implement it based off the provided documentation. The simple question I have with this is: ExclusionRule("What is this", "What is this") In regards to what needs to be placed there I have not located that in the Docs. Thank you for responding, your assistance is appreciated. P.S. If a link to specific docs. to clearify this issue exists, please provide it. – Shawn Sampson Apr 08 '22 at 23:43
  • hope [this](https://stackoverflow.com/a/22638585/11236563) fixes your issue – Omar Tammam Apr 09 '22 at 11:50

0 Answers0