简体   繁体   English

Appengine Connected Android PRJ进行了404移动测试

[英]Appengine connected Android prj got 404 on mobile test

I got my android+appengine application (endpoint) up and running, everything works fine on my local machine, so I decided to upload my appengine code so that I can try accessing data through the Android application directly on my mobile phone. 我启动并运行了android + appengine应用程序(端点),在我的本地计算机上一切正常,因此我决定上传我的appengine代码,以便尝试直接在手机上通过Android应用程序访问数据。

When I try to call to my appengine backend, I got 404 error. 当我尝试致电我的Appengine后端时,出现404错误。

On browser if I try to call for http://[myAppID].appspot.com/_ah/spi I get: 在浏览器上,如果我尝试致电http:// [myAppID] .appspot.com / _ah / spi,则会得到:

Error: HTTP method GET is not supported by this URL 

So the main serlvet is responding, what am I doing wrong?? 所以主要的天鹅绒娃娃正在回应,我在做什么错?

(Permission for Internet granted!) (已授予Internet许可!)

Thanks in advance!! 提前致谢!!

here's the code, this is executed inside an AsyncTask: 这是代码,这是在AsyncTask内部执行的:

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

        Myendpoint endpoint = CloudEndpointUtils.updateBuilder(endpointBuilder).build();

        try {

            MyUsers result = endpoint.searchMyUser(params[0]).execute();

            return result.getItems().get(0);

        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

This is the code inside CloudEnpointUtils (obviously LOCAL_ANDROID_RUN is set to false) : 这是CloudEnpointUtils内部的代码(显然LOCAL_ANDROID_RUN设置为false):

public static <B extends GoogleClient.Builder> B updateBuilder(B builder) {
    if (LOCAL_ANDROID_RUN) {
        builder.setRootUrl(LOCAL_APP_ENGINE_SERVER_URL + "/_ah/api/");
    }
    // only enable GZip when connecting to remote server
    final boolean enableGZip = builder.getRootUrl().startsWith("https:");
    builder.setJsonHttpRequestInitializer(new JsonHttpRequestInitializer() {
        public void initialize(JsonHttpRequest jsonHttpRequest) {
            jsonHttpRequest.setEnableGZipContent(enableGZip);
        }
    });
    return builder;
}

I add the logcat for error: 我为错误添加logcat:

10-04 11:40:22.770 W/System.err(13564): com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
10-04 11:40:22.770 W/System.err(13564): Not Found
10-04 11:40:22.775 W/System.err(13564):     at com.google.api.client.googleapis.services.GoogleClient.executeUnparsed(GoogleClient.java:279)
10-04 11:40:22.775 W/System.err(13564):     at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:207)
10-04 11:40:22.775 W/System.err(13564):     at com.appspot.api.services.myuserendpoint.Myuserendpoint$SearchMyUser.execute(Myuserendpoint.java:702)
10-04 11:40:22.775 W/System.err(13564):     at it.my.my.app.core.MyBusinessDelegate$MyUserGetter.doInBackground(MyBusinessDelegate.java:303)
10-04 11:40:22.775 W/System.err(13564):     at it.my.my.app.core.MyBusinessDelegate$MyUserGetter.doInBackground(MyBusinessDelegate.java:1)
10-04 11:40:22.780 W/System.err(13564):     at android.os.AsyncTask$2.call(AsyncTask.java:264)
10-04 11:40:22.780 W/System.err(13564):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-04 11:40:22.780 W/System.err(13564):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-04 11:40:22.780 W/System.err(13564):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
10-04 11:40:22.785 W/System.err(13564):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
10-04 11:40:22.785 W/System.err(13564):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
10-04 11:40:22.785 W/System.err(13564):     at java.lang.Thread.run(Thread.java:856)

EDIT: AppEngine DeployLog 编辑:AppEngine DeployLog

------------ Deploying frontend ------------

 Preparing to deploy:
    Created staging directory at:  'C:\Users\XXXXXXXXX\AppData\Local\Temp\appcfg1884750854541661749.tmp'
    Scanning for jsp files.
    Compiling jsp files.
    Scanning files on local disk.
    Initiating update.
    Cloning 1 static files.
    Cloning 66 application files.

Deploying:
    Uploading 0 files.
    Initializing precompilation...
    Deploying new version.

Verifying availability:
    Will check again in 1 seconds.
    Will check again in 2 seconds.
    Will check again in 4 seconds.
    Closing update: new version is ready to start serving.

Updating datastore:
    Uploading index definitions.

Deployment completed successfully

EDIT2: other infos EDIT2:其他信息

I've tried to communicate with a java servlet I've put in appengine war, via browser there's no problem everything is working fine, if I try to ping from command line or try to communicate programmatically I have this error: 我已经尝试过与应用引擎大战中使用过的Java servlet进行通信,通过浏览器没有任何问题,一切正常,如果我尝试从命令行ping或尝试以编程方式进行通信,则会遇到此错误:

"Unable to resolve host "[myappID].appspot.com": No address associated with  hostname"

Please anybody help me find a solution 请任何人帮助我找到解决方案

EDIT 3: Good news, I've been able to call my servlet using the appengine address with version that is: 编辑3:好消息,我已经能够使用以下版本的appengine地址来调用我的servlet:

http://[version].[myAppID].appspot.com/myServlet

instead of: 代替:

http://[myAppID].appspot.com/myServlet 

I don't know why but this way it'works! 我不知道为什么,但是这样有效! Still no luck trying to call remote appengine app via endpoint even using version-address trick, hope this help! 即使使用版本地址技巧,尝试通过终结点调用远程appengine应用程序仍然不走运,希望此帮助!

The root cause is that the version being used in your code is different from the app engine default version. 根本原因是您的代码中使用的版本与App Engine默认版本不同。

The app engine default version is deployed to: http://[appversion]-your-product-id.appspot.com The code you are running though has specified the deployment version as 1 which means when deployed, your app will check here: http://1-dot-your-project-id.appspot.com hence the 404 (because in essence, this URL doesn't exit. I use one here for illustration purposes). 该应用引擎的默认版本已部署到:http:// [appversion] -your-product-id.appspot.com您正在运行的代码已将部署版本指定为1,这意味着在部署时,您的应用将在此处进行检查: http://1-dot-your-project-id.appspot.com,因此是404(因为从本质上讲,此URL不会退出。在这里我仅出于说明目的使用它)。

To resolve this, go to https://appengine.google.com/deployment?app_id=s~your-project-id and make the version you've uploaded the default version 要解决此问题,请转到https://appengine.google.com/deployment?app_id=s~your-project-id ,然后将您上传的版本设为默认版本

More here: App Engine Set-up hiccups 此处更多内容: App Engine设置问题

Looks like you have not been accepted to the trusted tester program. 看起来您尚未被信任的测试人员计划接受。 This will not work unless you are in the TT program. 除非您处于TT程序中,否则这将无法工作。 You can sign up at this page: 您可以在此页面上注册:

http://endpoints-trusted-tester.appspot.com/ http://endpoints-trusted-tester.appspot.com/

You will receive an email when(if) accepted. 如果接受,您将收到一封电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM