简体   繁体   English

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

[英]IOException: unexpected response from remote api

I'm having exactly the same problem as this person: 我和这个人有完全相同的问题:

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

but there are no responses and I can't see anything else on the internet that helps. 但是没有回复,我在互联网上看不到任何有帮助的东西。 Does anyone know why this would happen? 有谁知道为什么会这样?

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

The stacktrace is: 堆栈跟踪是:

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)

I've noticed you've set the <application> element inside appengine-web.xml to MyCorrectAppId . 我注意到你已经将appengine-web.xml中<application>元素设置为MyCorrectAppId That's the problem. 那就是问题所在。 As Eugene rightly pointed out, the ID must be all lowercase , like mycorrectappid . 正如Eugene正确指出的那样, ID必须全部小写 ,就像mycorrectappid一样。 Quoting Dan Sanderson's book Programming Google App Engine : 引用Dan Sanderson的书“ 编程Google App Engine”

Because the application ID is used in the domain name, an ID can contain only lowercase letters, numbers, or hyphens, and must be shorter than 32 characters. 由于域名中使用了应用程序ID,因此ID只能包含小写字母,数字或连字符,且必须短于32个字符。 Additionally, Google reserves every Gmail username as an application ID that only the corresponding Gmail user can register. 此外,Google会将每个Gmail用户名保留为只有相应Gmail用户才能注册的应用程序ID。

If you are working in Eclipse, you need to remember that when setting up a new web application project (there is an option towards the bottom of the "New Web Application Project" dialogue that allows you to specify the ID instead of leaving it blank). 如果您在Eclipse中工作,则需要记住在设置新的Web应用程序项目时(“新建Web应用程序项目”对话框底部有一个选项,允许您指定ID而不是将其留空) 。

在此输入图像描述

For a standalone environment, I think you're probably fine if you leave the ID blank (it will default to "no_app_id"). 对于独立环境,如果您将ID留空(我将默认为“no_app_id”),我认为您可能没问题。

Hope that helps! 希望有所帮助!

According to the code of the RemoteApiInstaller.getAppIdFromServer method the exception unexpected response from remote api can be thrown when no app_id property found in the response body. 根据RemoteApiInstaller.getAppIdFromServer方法的代码 ,当在响应正文中找不到app_id属性时,可以抛出unexpected response from remote api的异常unexpected response from remote api And it seems that in your case it is probable that MyCorrectAppId does not match the PAIR_REGEXP pattern, ie it contains any characters other than digits, letters in lower case, tilde, underscore or minus sign. 在您的情况下,似乎MyCorrectAppId可能与PAIR_REGEXP模式不匹配,即它包含除数字以外的任何字符,小写字母,波浪号,下划线或减号。

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

相关问题 Solr SimplePostTool:读取响应时出现IOException:java.net.SocketException:服务器中的文件意外结束 - Solr SimplePostTool: IOException while reading response: java.net.SocketException: Unexpected end of file from server java.io.IOException:CONNECT的意外响应代码:405 - java.io.IOException: Unexpected response code for CONNECT: 405 java.io.IOException:CONNECT 的意外响应代码:400 - java.io.IOException: Unexpected response code for CONNECT: 400 Spring Rest API控制器的意外JSon响应 - Unexpected JSon response from Spring Rest API Controller Solr响应产生意外结果 - unexpected results from solr response java io ioexception无法解析服务器地理编码器的响应 - java io ioexception unable to parse response from server geocoder 从错误响应中获取数据时出现 java.io.IOException - java.io.IOException when getting data from error response 发布大数据时,Java IOException“服务器中的文件意外结束” - Java IOException “Unexpected end of file from server” when posting large data Flume:来自下游的意外异常。 java.io.IOException:对等重置连接 - Flume : Unexpected exception from downstream. java.io.IOException: Connection reset by peer 如何从Volley捕获意外的响应错误 - How to catch unexpected response errors from Volley
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM