当使用gae远程错误时:com.google.appengine.repackaged.com.google.api.client.http.HttpResponseException:302

时间:2016-06-16 07:14:08

标签: google-app-engine

当我使用gae remote api连接到远程服务器时出现错误,如:

Id

我的代码就像文档提供的那样:

com.google.appengine.repackaged.com.google.api.client.http.HttpResponseException: 302
        at com.google.appengine.repackaged.com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1070)
        at com.google.appengine.tools.remoteapi.OAuthClient.get(OAuthClient.java:64)
        at com.google.appengine.tools.remoteapi.RemoteApiInstaller.getAppIdFromServer(RemoteApiInstaller.java:413)
        at com.google.appengine.tools.remoteapi.RemoteApiInstaller.loginImpl(RemoteApiInstaller.java:376)
        at com.google.appengine.tools.remoteapi.RemoteApiInstaller.login(RemoteApiInstaller.java:337)
        at com.google.appengine.tools.remoteapi.RemoteApiInstaller.install(RemoteApiInstaller.java:173)
        at com.test.gae.ConnectRemoteGAETest.testConnect(ConnectRemoteGAETest.java:56)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

我的代码中有什么问题以及如何解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

i solved the problem by add this into web.xml

<servlet>
        <display-name>Remote API Servlet</display-name>
        <servlet-name>RemoteApiServlet</servlet-name>
        <servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>RemoteApiServlet</servlet-name>
        <url-pattern>/remote_api</url-pattern>
    </servlet-mapping>