Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-2984

“NoSuchMethodErrors” due to multiple versions of com.google.guava:guava:jar

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0
    • None
    • Ranger
    • None

    Description

      Issue description

      Hi, there are multiple versions of com.google.guava:guava in ranger\unixauthclient. As shown in the following dependency tree, according to Maven's “nearest wins” strategy, only com.google.guava:guava:25.1-jre can be loaded, com.google.guava:guava:16.0.1 will be shadowed.

      However, one method defined in shadowed version com.google.guava:guava:16.0.1 is referenced by client project org.apache.hadoop:hadoop-auth:3.1.1, but missing in the actually loaded version com.google.guava:guava:25.1-jre.

      For instance, the following missing method(defined in com.google.guava:guava:16.0.1) is actually referenced by ranger\unixauthclient, which will introduce a runtime error(i.e., "NoSuchMethodError") into ranger\unixauthclient.\

      Missing method: com.google.common.reflect.TypeToken: java.lang.reflect.Type access$400(com.google.common.reflect.TypeToken) is invoked by ranger\unixauthclient via the following path:

      paths------
      <org.apache.ranger.authentication.unix.jaas.RemoteUnixLoginModule: boolean commit()> ranger\unixauthclient\target\classes
      <org.apache.curator.shaded.com.google.common.collect.Collections2$FilteredCollection: boolean add(java.lang.Object)> Repositories\org\apache\curator\curator-client\2.12.0\curator-client-2.12.0.jar
      <org.apache.curator.shaded.com.google.common.reflect.TypeToken$TypeFilter$1: boolean apply(java.lang.Object)> Repositories\org\apache\curator\curator-client\2.12.0\curator-client-2.12.0.jar
      <org.apache.curator.shaded.com.google.common.reflect.TypeToken$TypeFilter$1: boolean apply(com.google.common.reflect.TypeToken)> Repositories\org\apache\curator\curator-client\2.12.0\curator-client-2.12.0.jar
      <com.google.common.reflect.TypeToken: java.lang.reflect.Type access$400(com.google.common.reflect.TypeToken)>

      Suggested fixing solutions

      1. Upgrade dependency org.apache.hadoop:hadoop-auth from 3.1.1 to 3.3.0. Because the newer version org.apache.hadoop:hadoop-auth:3.3.0 does not invoke the above missing method, such upgrading can solve the problem.
      2. Change dependency com.google.guava:guava from 25.1-jre to 24.0-jre. Because version 24.0-jre includes the above missing method and is compatible with other versions of com.google.guava:guava .

      Please let me know which solution do you prefer? I can submit a PR to fix it.

      Thank you very much for your attention.
      Best regards,

      Dependency tree----

      [INFO] org.apache.ranger:unixauthclient:jar:3.0.0-SNAPSHOT
      [INFO] +- *com.google.guava:guava:jar:25.1-jre:compile*
      [INFO] - org.apache.hadoop:hadoop-auth:jar:3.1.1:compile
      [INFO] +- org.apache.curator:curator-framework:jar:2.12.0:compile
      [INFO] | - org.apache.curator:curator-client:jar:2.12.0:compile
      [INFO] | - *(com.google.guava:guava:jar:16.0.1:compile - omitted for conflict with 25.1-jre)*
      [INFO] - (com.google.guava:guava:jar:11.0.2:compile - omitted for conflict with 25.1-jre)

      Attachments

        Activity

          People

            Unassigned Unassigned
            Bing-ok Bing-ok
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m