尝试将新对象插入应用程序引擎数据库时出错

时间:2012-12-01 17:36:51

标签: android google-app-engine google-cloud-endpoints

这是我第一次尝试启动应用程序引擎,所以也许我只是错过了某个步骤,但我试图将内容插入应用程序引擎数据库中

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();
        }

当我通过模拟器在本地服务器上运行它时工作正常但是当我将代码上传到app引擎时,我得到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)

还有其他我想做的事吗?我使用此example作为参考

1 个答案:

答案 0 :(得分:0)

虽然Google Cloud Endpoints处于受信任的测试阶段,但在部署之前,您需要将应用程序列入白名单。要列入白名单,您必须申请trusted tester program并被接受。目前,我们已经放慢了接受率,因此您可能不会被接受,或者可能会在长时间延迟后被接受。

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