When I use gae remote api connect to remote server error occured like:
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)
My code just like what docs gives:
RemoteApiOptions options = new RemoteApiOptions()
.server("your_app_id.appspot.com", 443)
.useServiceAccountCredential("ser...@gserviceaccount.com",
"258a5.p12");
RemoteApiInstaller installer = new RemoteApiInstaller();
installer.install(options);
// ... all API calls executed remotely
installer.uninstall();
Is there something wrong in my code and how to handle this?
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>