RelationalAI / rai-sdk-java

The RelationalAI Software Development Kit (SDK) for Java.
Apache License 2.0
5 stars 1 forks source link

Java SDK dependencies include SLF4J bindings which conflict with client bindings #31

Open andrew-bate-rai opened 1 year ago

andrew-bate-rai commented 1 year ago

The current dependencies of the Java SDK include the SJF4J Simple bindings for SLF4J:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.25</version>
</dependency>

The problem with including this as a dependency is that a client using the Java SDK may wish to specify their own SLF4J bindings.

For example, if a client specifies Logback Classic as the SLF4J bindings with

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.11</version>
</dependency>

then you will get the following warnings:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/rai/.m2/repository/ch/qos/logback/logback-classic/1.2.11/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/rai/.m2/repository/org/slf4j/slf4j-simple/1.7.36/slf4j-simple-1.7.36.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]

I encountered this when working on an actual client project that uses the Java SDK.

I think instead we should have a dependency on the SLF4J API but should avoid specifying any particular bindings in the Java SDK itself. For example, we should use the dependency:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.36</version>
</dependency>
billscheidel-rai commented 1 year ago

Note: This issue has been migrated to https://relationalai.atlassian.net/browse/RAI-8133.

This link is only accessible to employees of RelationalAI.