```
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/Users/lianjia/repo/hbaseWS/lib/phoenix-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/Users/lianjia/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.

java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be
cast to ch.qos.logback.classic.LoggerContext
```

According to the error, slf4j simply uses the first binding it finds. The
workaround is to also add logback-classic-1.2.3.jar as an unmanaged
dependency which overrides the one provided by phoenix-client.jar. A better
way is to check if I can control the
visibility order of the runtime dependencies so that I don't need such
hacky workaround.

On Fri, Apr 20, 2018 at 11:07 AM, Lian Jiang <[email protected]> wrote:

> Thanks Gonzalo.
>
> pheonix-client.jar is added as an unmanaged jar in my sbt project and sbt
> cannot exclude its dependencies.
>
> Without the pheonix-client.jar's source code, how can I create a jar (e.g.
> myclient.jar) wrapping phoenix-client.jar while shading its logging
> dependency?
>
> Thanks for any clue!
>
> On Fri, Apr 20, 2018 at 12:30 AM, Gonzalo Herreros <[email protected]>
> wrote:
>
>> The newer versions don't include the client in the core, I think.
>> Otherwise 4.7.0 phoenix-core should contain the driver (but it doesn't
>> include tephra which it needs)
>>
>> However, what you should do is exclude or override the logging dependency
>> in phoenix (don't know how that is done in gradle) or as a last resort
>> shade the client jar
>>
>> On 19 April 2018 at 18:38, Lian Jiang <[email protected]> wrote:
>>
>>> I am using HDP 2.6 hbase and pheonix. I created a play rest service
>>> using hbase as the backend. However, I have trouble to get a working
>>> pheonix client.
>>>
>>> I tried the pheonix-client.jar given by HDP but its logging dependency
>>> conflicts with play's. Then I tried:
>>>
>>> libraryDependencies += "org.apache.phoenix" % "phoenix-core" %
>>> "4.13.1-HBase-1.1"
>>>
>>> libraryDependencies += "org.apache.phoenix" % "phoenix-server-client" %
>>> "4.7.0-HBase-1.1"
>>>
>>> libraryDependencies += "org.apache.phoenix" %
>>> "phoenix-queryserver-client" % "4.13.1-HBase-1.1"
>>>
>>> None of them worked: "No suitable driver found".
>>>
>>> Any idea will be highly appreciated!
>>>
>>>
>>
>

Reply via email to