Home » Android » google app engine – Android Mobile Backend Starter fail with 404 not found… some times

google app engine – Android Mobile Backend Starter fail with 404 not found… some times

Posted by: admin June 15, 2020 Leave a comment

Questions:

Last afternoon I created a project and deployed the mobile backend started. I edited the client code and sucessfully did some data insertion.

Some time (hours) after, I changed the cliend code again and the insertion failed with the error:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found

As I didn’t did any substantial change in the code I concluded that the error was on the app engine side so I redeployed the project and that solved the problem. The insertions came through again.

This morning I was back with the 404 error. This time redeploying didn’t work.

The error log I get in the app engine is:

Uncaught exception from servlet
javax.servlet.UnavailableException: com.google.api.server.spi.config.ApiConfigException: <Entity [GoogleCloudEndpointConfiguration("EndpointV1")]:
    clientIds = null
    audiences = null
>
.audiences was not of type String or List<String>.
    at org.mortbay.jetty.servlet.ServletHolder.makeUnavailable(ServletHolder.java:415)
    at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:451)
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:57)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:439)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:480)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:487)
    at com.google.tracing.TraceContext.runInContext(TraceContext.java:774)
    at com.google.tracing.TraceContext$DoInTraceContext.runInContext(TraceContext.java:751)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:342)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:334)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:484)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
    at java.lang.Thread.run(Thread.java:722)

Any idea what is happening and what can I do to solve it?

How to&Answers:

I do not completely understand what is going on, but I found a way to get rid of the 404 errors on the client side, which are caused by the App Engine side not responding. The errors reported in the app engine logs are talking about audience and client ids for the app. Those are the values you set when you configure authentication for “Secured by Client Ids”.

Mobile Backend Settings page

I found that if I put in some placeholder string values in there, saved, and then went back to “Open (for development use only)” and saved again, the app engine would no longer have config errors and would response to the client Android app.

At the moment I am only to the place where entries are made in the Guestbook data. But this definitely got me started again. I am hoping that if I set up authentication completely that the problem will not come back.

Answer:

I was getting the same error, the error went away after redeploying the backend app on cloud console.

Answer:

I found that after redeploy a new version is created, instead of reseting the default one.
When selecting this new version as ‘default’ everything worked as expected.

Select instance as default at (Main / Version):

https://appengine.google.com/adminlogs?&app_id=<project_id>

Check at:

https://<project_id>.appspot.com/_ah/api/explorer

Answer:

Here is the perfect fix.

Log on to the app engine. Click on Instances on the left hand side.
At the right bottom , you will see an option as “Shutdown”

Click on Shutdown. (Shutdown is not just shutdown. Its a restart).

The instance gets started in 10-12 seconds. Note : During these 10-12 seconds , the app engine is not accessible. So, if your app is live , your cloud will not work for these 10-12 seconds.

Refresh the page after 10 seconds and make sure you see the Shutdown option . This means your instance is restarted.

Now , retry and it will work. Send me email to [email protected] if you still have questions