我正尝试使用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