谷歌云存储 - 入门

时间:2015-06-17 12:18:56

标签: google-app-engine

我正在尝试按照GCS入门指南 - https://cloud.google.com/appengine/docs/java/googlecloudstorageclient/getstarted

它说我应该下载客户端库,我是用git做的。

然后它说:

  

在“库”选项卡中,单击“添加外部JAR”。你必须添加   关注JAR:

     

appengine-gcs-client.jar来自安装云存储的任何位置   客户端库

     

guava-15.0.jar来自您安装云存储客户端的任何位置   文库

     

joda-time-2.3.jar来自您安装云存储客户端的任何位置   文库

     来自App Engine安装子目录的

appengine-testing.jar   / LIB /测试。

     来自App Engine安装子目录/ lib / impl的

appengine-api.jar。

     来自App Engine安装子目录的

appengine-api-stubs.jar   / LIB / IMPL。

但是下载中绝对没有罐子,

我错过了什么?

编辑: 我设法在网上找到丢失的罐子,现在我得到:

  

线程中的异常" main" java.util.ServiceConfigurationError:   com.google.appengine.spi.FactoryProvider:Provider   com.google.appengine.api.search.ISearchServiceFactoryProvider可以   没有被实例化   java.util.ServiceLoader.fail(ServiceLoader.java:224)at   java.util.ServiceLoader.access $ 100(ServiceLoader.java:181)at   java.util.ServiceLoader $ LazyIterator.next(ServiceLoader.java:377)at at   java.util.ServiceLoader $ 1.next(ServiceLoader.java:445)at   com.google.appengine.spi.ServiceFactoryFactory $ 1.run(ServiceFactoryFactory.java:148)     在   com.google.appengine.spi.ServiceFactoryFactory $ 1.run(ServiceFactoryFactory.java:130)     在java.security.AccessController.doPrivileged(Native Method)at   com.google.appengine.spi.ServiceFactoryFactory.getProvidersUsingServiceLoader(ServiceFactoryFactory.java:130)     在   com.google.appengine.spi.ServiceFactoryFactory.access $ 100(ServiceFactoryFactory.java:39)     在   com.google.appengine.spi.ServiceFactoryFactory $ RuntimeRegistry。(ServiceFactoryFactory.java:109)     在   com.google.appengine.spi.ServiceFactoryFactory.getFactory(ServiceFactoryFactory.java:67)     在   com.google.appengine.api.datastore.DatastoreServiceFactory.getFactory(DatastoreServiceFactory.java:78)     在   com.google.appengine.api.datastore.DatastoreServiceFactory.getDatastoreService(DatastoreServiceFactory.java:20)     在   com.google.appengine.api.datastore.DatastoreServiceFactory.getDatastoreService(DatastoreServiceFactory.java:40)     在   com.google.appengine.tools.cloudstorage.dev.LocalRawGcsService。(LocalRawGcsService.java:87)     在   com.google.appengine.tools.cloudstorage.dev.LocalRawGcsServiceFactory.createLocalRawGcsService(LocalRawGcsServiceFactory.java:29)     在   com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:66)     在   com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:44)     在   com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:40)     在   com.google.appengine.demos.LocalExample。(LocalExample.java:54)     在   com.google.appengine.demos.LocalExample.main(LocalExample.java:129)   引起:java.lang.VerifyError:class   com.google.appengine.repackaged.com.google.appengine.api.search.SearchServicePb $ DeleteDocumentRequest   覆盖最终方法   。getUnknownFields()LCOM /谷歌/应用服务引擎/重新打包/ COM /谷歌/ protobuf的/ UnknownFieldSet;     at java.lang.ClassLoader.defineClass1(Native Method)at   java.lang.ClassLoader.defineClass(ClassLoader.java:800)at   java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)     在java.net.URLClassLoader.defineClass(URLClassLoader.java:449)at   java.net.URLClassLoader.access $ 100(URLClassLoader.java:71)at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:361)at   java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)at   java.security.AccessController.doPrivileged(Native Method)at   java.net.URLClassLoader.findClass(URLClassLoader.java:354)at   java.lang.ClassLoader.loadClass(ClassLoader.java:425)at   sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)at at   java.lang.ClassLoader.loadClass(ClassLoader.java:358)at   com.google.appengine.api.search.SearchServiceFactoryImpl。(SearchServiceFactoryImpl.java:13)     在   com.google.appengine.api.search.ISearchServiceFactoryProvider。(ISearchServiceFactoryProvider.java:16)     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native   方法)at   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)     在   sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)     在java.lang.Class.newInstance(Class.java:379)at   java.util.ServiceLoader $ LazyIterator.next(ServiceLoader.java:373)...   18更多

似乎这个指南从未真正经过测试,完全是浪费时间,还是什么?

1 个答案:

答案 0 :(得分:0)

我陷入了同样的麻烦,对我有用:

  1. 将库(appengine + appengine-testing)更新为同一版本
    • 我曾经有过appengine版本1.9.18和appenginte-testing版本1.4.0。现在我有版本1.9.25(目前最新版本)
  2. 添加了所有必需的库
    • appengine-api-labs和appengine-api-stubs缺失
  3. 我的build.gradle配置现在包含:

    dependencies {
        appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.25'
        compile 'com.google.appengine:appengine-endpoints:1.9.25'
        compile 'com.google.appengine:appengine-endpoints-deps:1.9.25'
        compile 'com.googlecode.objectify:objectify:5.1.5'
        compile 'javax.servlet:servlet-api:2.5'
        testCompile 'junit:junit:4.12'
        testCompile 'com.google.appengine:appengine-testing:1.9.25'
        testCompile 'com.google.appengine:appengine-api-labs:1.9.25'
        testCompile 'com.google.appengine:appengine-api-stubs:1.9.25'
    
    }