NoSuchMethodError in Google Cloud Storage Java API

Viewed 66

I've got a Google App Engine project using Java Servlets. I've setup a service account in Cloud Platform and I have downloaded the key (as JSON). In my TestServlet I'm getting the Storage object like this:

FileInputStream fis = null;
try {
    fis = new FileInputStream(Constants.DIRECTORY_CREDENTIALS_SEVICE_ACCOUNT);
}
catch (FileNotFoundException e) {
    return;
}
GoogleCredentials credentials = GoogleCredentials.fromStream(fis);
Storage storage = StorageOptions.newBuilder().setCredentials(credentials).build().getService();

Then I try to test my configuration listing buckets and the response is:

HTTP ERROR 500 java.lang.NoSuchMethodError: com.google.api.services.storage.model.Bucket.getIamConfiguration()Lcom/google/api/services/storage/model/Bucket$IamConfiguration;

I don't know what to do... My pom is:

<dependencies>
    <dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-storage</artifactId>
    </dependency>
<dependencies>

<dependencyManagement>
<dependencies>
    <dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>libraries-bom</artifactId>
    <version>20.3.0</version>     
    <type>pom</type>
    <scope>import</scope>
    </dependency>
</dependencies>
</dependencyManagement>
0 Answers
Related