繁体   English   中英

IOException:来自远程api的意外响应

[英]IOException: unexpected response from remote api

我和这个人有完全相同的问题:

https://groups.google.com/forum/#!topic/google-appengine-java/4y90M9NlWsA

但是没有回复,我在互联网上看不到任何有帮助的东西。 有谁知道为什么会这样?

    RemoteApiOptions options = new RemoteApiOptions()
        .server("localhost", 8888)
        .credentials("blah@blah.blah", "");
    RemoteApiInstaller installer = new RemoteApiInstaller();
    installer.install(options);

堆栈跟踪是:

Exception in thread "main" java.io.IOException: unexpected response from remote api: {rtok: null, app_id: MyCorrectAppId}

at com.google.appengine.tools.remoteapi.RemoteApiInstaller.getAppIdFromServer(RemoteApiInstaller.java:326)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.loginImpl(RemoteApiInstaller.java:278)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.login(RemoteApiInstaller.java:239)
at com.google.appengine.tools.remoteapi.RemoteApiInstaller.install(RemoteApiInstaller.java:106)
at uk.blah.blah.MyClass.main(MyClass.java:114)

我注意到你已经将appengine-web.xml中<application>元素设置为MyCorrectAppId 那就是问题所在。 正如Eugene正确指出的那样, ID必须全部小写 ,就像mycorrectappid一样。 引用Dan Sanderson的书“ 编程Google App Engine”

由于域名中使用了应用程序ID,因此ID只能包含小写字母,数字或连字符,且必须短于32个字符。 此外,Google会将每个Gmail用户名保留为只有相应Gmail用户才能注册的应用程序ID。

如果您在Eclipse中工作,则需要记住在设置新的Web应用程序项目时(“新建Web应用程序项目”对话框底部有一个选项,允许您指定ID而不是将其留空) 。

在此输入图像描述

对于独立环境,如果您将ID留空(我将默认为“no_app_id”),我认为您可能没问题。

希望有所帮助!

根据RemoteApiInstaller.getAppIdFromServer方法的代码 ,当在响应正文中找不到app_id属性时,可以抛出unexpected response from remote api的异常unexpected response from remote api 在您的情况下,似乎MyCorrectAppId可能与PAIR_REGEXP模式不匹配,即它包含除数字以外的任何字符,小写字母,波浪号,下划线或减号。

暂无
暂无

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

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