Skip to content

Invalid version of google-http-client library bundled #55

Description

@codepainters

It seems that release-and-dependencies.zip for v1.0.5 and v1.0.6 (as downloadable from this repo's releases) comes with too old HTTP client library (google-http-client-1.39.2.jar), leading to exception, when trying to use Kafka CLI:

Caused by: java.lang.NoSuchMethodError: 'int com.google.api.client.http.HttpResponseException.getAttemptCount()'
        at com.google.auth.oauth2.GoogleAuthException.createWithTokenEndpointResponseException(GoogleAuthException.java:124)
        at com.google.auth.oauth2.GoogleAuthException.createWithTokenEndpointResponseException(GoogleAuthException.java:143)
        at com.google.auth.oauth2.UserCredentials.doRefreshAccessToken(UserCredentials.java:273)
        at com.google.auth.oauth2.UserCredentials.idTokenWithAudience(UserCredentials.java:206)
        at com.google.auth.oauth2.IdTokenCredentials.refreshAccessToken(IdTokenCredentials.java:125)

This happens when I try to use it after token expiration.

Environment details

  • OS: Ubuntu 25.04, x86_64
  • openjdk version "21.0.9" 2025-10-21
  • kafka_2.13-3.7.2.tgz

Steps to reproduce

  1. Setup everything as in https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/quickstart
  2. Try to list topics with:
    kafka-topics.sh --list \
     --bootstrap-server $BOOTSTRAP \
     --command-config client.properties
    

The problem: OAuth2 library tries to call HttpResponseException.getAttemptCount(), which is not present in google-http-client-1.39.2.jar (it was introduced in v1.41).

It works (i.e., fails with exception related to expired token) after replacing HTTP client with newer version:

rm -f "$KAFKA_HOME/libs/google-http-client-1.39.2.jar" \
      "$KAFKA_HOME/libs/google-http-client-apache-v2-1.39.2.jar" \
      "$KAFKA_HOME/libs/google-http-client-gson-1.39.2.jar"
wget -P "$KAFKA_HOME/libs/" \
    https://repo1.maven.org/maven2/com/google/http-client/google-http-client/1.45.3/google-http-client-1.45.3.jar \
    https://repo1.maven.org/maven2/com/google/http-client/google-http-client-apache-v2/1.45.3/google-http-client-apache-v2-1.45.3.jar \
    https://repo1.maven.org/maven2/com/google/http-client/google-http-client-gson/1.45.3/google-http-client-gson-1.45.3.jar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions