Error while using Java API

355 views
Skip to first unread message

Neelam Jain

unread,
Mar 10, 2021, 4:13:17 PM3/10/21
to Google Cloud Filestore Discuss

Hello,

I am trying to upload files to google bucket. I am using the following standard code

 Storage storage = StorageOptions.newBuilder().setProjectId(projectId).build().getService();
    BlobId blobId = BlobId.of(bucketName, objectName);
    BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
    storage.create(blobInfo, Files.readAllBytes(Paths.get(filePath)));

However, i am receiving the following error

Exception in thread "main" java.lang.NoSuchMethodError: com.google.cloud.ServiceOptions.getQuotaProjectId()Ljava/lang/String;

I have google-cloud-core-1.25.0.jar as Referenced Library in my Eclipse project. I checked the ServiceOptions class in the library, but could not see any method getQuotaProjectId(). Do i need to add any additional jar file or my version is not correct

Regards
Neelam Jain

George Suceveanu

unread,
Apr 21, 2021, 2:13:49 PM4/21/21
to Google Cloud Filestore Discuss
This looks like a library issue. It's worthwhile checking your imports attentively. You can find a similar problem with a suggested solution in reply to the "Listing buckets with Google Cloud Storage resulting in NoSuchMethodError, Java AppEngine" question in stackoverflow. Maybe worth mentioning: this is a discussion group for Google App Engine, and related problems and trends. When it comes strictly to programming and coding in Java, you’ll be at an advantage to rather post your questions on Stackoverflow, to gain this way access to a large number of experts; it is meant for providing you help with coding. 
Reply all
Reply to author
Forward
0 new messages