New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Cloud Storage: NoSuchMethodError for method setReturnRawInputStream() #6435
Comments
@Brett-Wood I'm not able to reproduce this issue below are the code snippets and output. Code :
Output :
|
Thank you for your help and trying to reproduce the issue. I was able to reproduce it again this morning public static String readBlobContent(Storage storage, String bucketName, String blobName, Connection con, String email, String fileName) throws Exception {
PreparedStatement update_pstmt = null;
String document_key = String.valueOf(System.currentTimeMillis());
try{
try(ReadChannel reader = storage.reader(bucketName, blobName)) {
ByteBuffer bytes = ByteBuffer.allocate(64*1024);
while(reader.read(bytes) > 0) {
byte buffer[] = new byte[64*1024];
bytes.flip();
bytes.get(buffer);
update_pstmt = con.prepareStatement("UPDATE table SET DOCUMENT=DOCUMENT+? WHERE DOCUMENT_KEY=?");
update_pstmt.setBytes(1, buffer);
update_pstmt.setString(2, document_key);
update_pstmt.executeUpdate();
bytes.clear();
}
reader.close();
}
return document_key;
} catch(Exception e) {
throw e;
} finally {
DBUtil.closeConnections(null, update_pstmt, null, null);
}
} Here is the full stack trace from the replicated issue:
Do you think that there is a chance it could be conflicting maven dependencies in my project? I only have one goolge-cloud-storage dependency listed in my project, but I do have other google API dependencies as well such as google-cloud-bigquery (version 1.53). Thanks again for your help. |
@Brett-Wood can you please post project dependency tree? |
This can be closed. I realized that I never updated my google-api-client dependency, so I updated that and it resolved my issue. Thank you for your help! |
Environment details
OS type and version: MacOS Mojave 10.14.6
Java version: 1.8.0_161
google-cloud-java version(s): Maven dependency
Code example
Stack trace
Any additional information below
I have a working version that uses blob.getContent in order to retrieve the file from storage, but due to some limitations on my end I need to stream the file in chunks. When I refactored my code to use the ReadChannel I started running into this issue. I really appreciate any and all help I can get with this. From my understanding it could be an issue with my google-cloud-java version, but I tried updating to 1.93 and I still ran into this issue. Thank you in advance!
The text was updated successfully, but these errors were encountered: