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

时间:2022-02-09 01:29:37

This is my first run at getting app engine working so maybe I just missed a step somewhere but I am trying to insert stuff into the app engine database like this

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

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

When I run this on the local server through the emulator it works fine but when I uploaded the code to app engine I get a response error

当我通过模拟器在本地服务器上运行它时工作正常,但当我将代码上传到app引擎时,我收到了响应错误

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)

was there something else I was suppose to do? I was using this example as reference

还有其他我想做的事吗?我使用这个例子作为参考

1 个解决方案

#1


0  

While Google Cloud Endpoints is in the trusted tester phase, you will need to have your application whitelisted before you can deploy it. To be whitelisted, you must apply to the trusted tester program and be accepted. Currently, we've slowed the rate of acceptance, so you may not be accepted, or may be accepted after a long delay.

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

Local development, as you've seen, should work fine.

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

#1


0  

While Google Cloud Endpoints is in the trusted tester phase, you will need to have your application whitelisted before you can deploy it. To be whitelisted, you must apply to the trusted tester program and be accepted. Currently, we've slowed the rate of acceptance, so you may not be accepted, or may be accepted after a long delay.

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

Local development, as you've seen, should work fine.

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