1

这是我第一次让应用引擎工作,所以也许我只是错过了某个地方的一步,但我正在尝试像这样将东西插入到应用引擎数据库中

Builder endpointBuilder = new Manufacturerendpoint.Builder(AndroidHttp.newCompatibleTransport(),new JacksonFactory()
    , new HttpRequestInitializer() {
        public void initialize(HttpRequest httpRequest) { }
    });

    Manufacturerendpoint manufacturer = CloudEndpointUtils.updateBuilder(endpointBuilder).build();



    String[] manufacturers = this.getResources().getStringArray(R.array.manufacturers);
    ContentValues v = new ContentValues();
    ContentValues val = new ContentValues();
    for(int i = 0; i < manufacturers.length; i++){
        Manufacturer manu = new Manufacturer();
        manu.setManufacturerName(manufacturers[i]);
        manu.setManufacturerID(i);
        try{
            Manufacturer result = manufacturer.insertManufacturer(manu).execute();
            Log.d("TAG", "TAG");
        }catch(Exception e){
            e.printStackTrace();
        }

当我通过模拟器在本地服务器上运行它时,它工作正常,但是当我将代码上传到应用引擎时,我得到一个response error

12-01 12:06:16.019: W/System.err(2589): com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
12-01 12:06:16.019: W/System.err(2589): Not Found
12-01 12:06:16.029: W/System.err(2589):     at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:114)
12-01 12:06:16.029: W/System.err(2589):     at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
12-01 12:06:16.029: W/System.err(2589):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:417)
12-01 12:06:16.039: W/System.err(2589):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
12-01 12:06:16.039: W/System.err(2589):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
12-01 12:06:16.039: W/System.err(2589):     at com.tyczj.bowling.Bowlers.tables(Bowlers.java:716)
12-01 12:06:16.039: W/System.err(2589):     at com.tyczj.bowling.Bowlers.run(Bowlers.java:859)
12-01 12:06:16.039: W/System.err(2589):     at java.lang.Thread.run(Thread.java:856)
12-01 12:24:21.989: W/System.err(2589): javax.net.ssl.SSLException: Read error: ssl=0x670d1160: I/O error during system call, Connection reset by peer
12-01 12:24:22.029: W/System.err(2589):     at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method)
12-01 12:24:22.029: W/System.err(2589):     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:664)
12-01 12:24:22.039: W/System.err(2589):     at libcore.io.Streams.readSingleByte(Streams.java:41)
12-01 12:24:22.039: W/System.err(2589):     at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:648)
12-01 12:24:22.039: W/System.err(2589):     at libcore.io.Streams.readAsciiLine(Streams.java:201)
12-01 12:24:22.049: W/System.err(2589):     at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:573)
12-01 12:24:22.049: W/System.err(2589):     at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:821)
12-01 12:24:22.049: W/System.err(2589):     at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
12-01 12:24:22.059: W/System.err(2589):     at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:495)
12-01 12:24:22.059: W/System.err(2589):     at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:134)
12-01 12:24:22.059: W/System.err(2589):     at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
12-01 12:24:22.059: W/System.err(2589):     at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:101)
12-01 12:24:22.059: W/System.err(2589):     at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:980)
12-01 12:24:22.069: W/System.err(2589):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:399)
12-01 12:24:22.069: W/System.err(2589):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
12-01 12:24:22.069: W/System.err(2589):     at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
12-01 12:24:22.069: W/System.err(2589):     at com.tyczj.bowling.Bowlers.tables(Bowlers.java:716)
12-01 12:24:22.069: W/System.err(2589):     at com.tyczj.bowling.Bowlers.run(Bowlers.java:859)
12-01 12:24:22.079: W/System.err(2589):     at java.lang.Thread.run(Thread.java:856)

还有什么我应该做的吗?我用这个例子作为参考

4

1 回答 1

0

虽然 Google Cloud Endpoints 处于受信任的测试人员阶段,但您需要先将您的应用程序列入白名单,然后才能部署它。要被列入白名单,您必须申请受信任的测试人员计划并被接受。目前,我们已经放慢了接受速度,因此您可能不会被接受,或者可能会在很长一段时间后被接受。

如您所见,本地开发应该可以正常工作。

于 2012-12-03T18:06:19.453 回答