Uploaded image for project: 'Couchbase Java Client'
  1. Couchbase Java Client
  2. JCBC-1963

Allow developers to manage dependencies

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Incomplete
    • None
    • None
    • build, Core
    • None
    • 1

    Description

      I have an application that uses both amazon-kinesis-client and couchbase java-client. I ran into an issue where a class is on the classpath multiple times. This results in a method not found exception.

      Caused by: java.lang.NoSuchMethodError: 'io.netty.channel.DefaultChannelId io.netty.channel.DefaultChannelId.newInstance()'    at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:113)    at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:73)    at io.netty.bootstrap.FailedChannel.<init>(FailedChannel.java:33)    at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:320)    at io.netty.bootstrap.Bootstrap.doResolveAndConnect(Bootstrap.java:155)    at io.netty.bootstrap.Bootstrap.connect(Bootstrap.java:116)    at io.netty.channel.pool.SimpleChannelPool.connectChannel(SimpleChannelPool.java:267)    at io.netty.channel.pool.SimpleChannelPool.acquireHealthyFromPoolOrNew(SimpleChannelPool.java:177)    at io.netty.channel.pool.SimpleChannelPool.acquire(SimpleChannelPool.java:162)    at io.netty.channel.pool.SimpleChannelPool.acquire(SimpleChannelPool.java:157)    at software.amazon.awssdk.http.nio.netty.internal.HonorCloseOnReleaseChannelPool.acquire(HonorCloseOnReleaseChannelPool.java:45) 

      What I found is there are three libraries that have embedded this class. Each embed a different version of netty.

      This creates a problem which is very difficult to trace and explain to other developers. There is also no really good solution without directly manipulating the classpath to put couchbase last (which may or may not work). I can't resolve any conflicts with netty at all using maven. Using a shaded jar is essential creating all of the problems maven was designed to fix with classpath resolution.

      What I propose is instead of creating a shaded jar for core-io create a normal jar with dependencies and allow developers to deal with conflicts using maven.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          John J Mercier is the issue that we bundle netty and repackage it under our own namespace? By doing so it shouldn't collide with the kinesis netty, right?

          daschl Michael Nitschinger added a comment - John J Mercier is the issue that we bundle netty and repackage it under our own namespace? By doing so it shouldn't collide with the kinesis netty, right?

          Do you mean it is put under a different package name? Ok I see it in my own screenshot. com.couchbase.client.deps.io.netty.channel. Thanks for the response! Using a different package name makes much more sense and it shouldn't cause issues with other dependencies!

          It looks like my issue is with the async-http-client. Thanks for the help!

          moaxcp John J Mercier added a comment - Do you mean it is put under a different package name? Ok I see it in my own screenshot. com.couchbase.client.deps.io.netty.channel. Thanks for the response! Using a different package name makes much more sense and it shouldn't cause issues with other dependencies! It looks like my issue is with the async-http-client. Thanks for the help!

          Ok I'm going to close this ticket then - let us know if you need anything else!

          daschl Michael Nitschinger added a comment - Ok I'm going to close this ticket then - let us know if you need anything else!

          People

            daschl Michael Nitschinger
            moaxcp John J Mercier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty