我正嘗試使用Google Cloud Storage Client Library對Appengine進行簡單的上載和下載。Google Cloud Storage:無法初始化類OauthRawGcsServiceFactory
執行過程中,它會返回這些錯誤:
java.lang.NoClassDefFoundError: Could not initialize class com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsServiceFactory
at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:42)
at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:34)
錯誤點到這裏:
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
GcsFilename fileName = getFileName(request);
GcsInputChannel readChannel = gcsService.openPrefetchingReadChannel(fileName, 0, BUFFER_SIZE);
copy(Channels.newInputStream(readChannel), response.getOutputStream());
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
GcsOutputChannel outputChannel = gcsService.createOrReplace(getFileName(request), GcsFileOptions.getDefaultInstance());
copy(request.getInputStream(), Channels.newOutputStream(outputChannel));
}
如何解決這個問題?
我試過你的解決方案,但它沒有奏效。謝謝,@Andrei Volgin! – benjtupas