GoogleJsonResponseException: 404 exception not found using Google application endpoint firewall

I followed the tutorial below.

https://developers.google.com/eclipse/docs/running_and_debugging_2_0

which basically added the GAE backend to my existing application. Then I will try the example below, run it on the local development server, and I get the exception below that occurs after

Note result = endpoint.insertNote(note).execute(); 

.

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

My code is below.

 package com.cloudnotes; import java.io.IOException; import java.util.Date; import android.os.AsyncTask; import android.content.Context; import com.cloudnotes.noteendpoint.Noteendpoint; import com.cloudnotes.noteendpoint.model.Note; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.http.HttpRequest; import com.google.api.client.http.HttpRequestInitializer; import com.google.api.client.json.jackson.JacksonFactory; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new EndpointsTask().execute(getApplicationContext()); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } public class EndpointsTask extends AsyncTask<Context, Integer, Long> { protected Long doInBackground(Context... contexts) { Noteendpoint.Builder endpointBuilder = new Noteendpoint.Builder( AndroidHttp.newCompatibleTransport(), new JacksonFactory(), new HttpRequestInitializer() { public void initialize(HttpRequest httpRequest) { } }); Noteendpoint endpoint = CloudEndpointUtils.updateBuilder( endpointBuilder).build(); try { Note note = new Note().setDescription("Note Description"); String noteID = new Date().toString(); note.setId(noteID); note.setEmailAddress("E-Mail Address"); Note result = endpoint.insertNote(note).execute(); } catch (IOException e) { e.printStackTrace(); } return (long) 0; } } } 
+6
source share
6 answers

Another possible reason for this problem is not to install the correct application in appengine-web.xml:

 <?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application>APPLICATION_ID_HERE</application> 

...

 </appengine-web-app> 
+5
source

Another possible reason for 404 is if you call a method with a null parameter and the method does not accept null parameters.

I had a similar problem with a method with 4 String parameters, and I sent null for one of them, and all I had was stupid 404.

Another possible reason for 404 on the development server (local) is that you have a parameter with some strange characters (such as a URL) that the development server (local) does not handle the event correctly if it works fine on active application servers. Possible solution: instead of several parameters, use a simple Java object.

+5
source

I had the same issue and fixed it.

Small background
I had two versions of the API deployed in App Engine, which I think should be fine. The admin console did not detect any problems, and I received the 200 OK code after deploying version 2 of the API in the log file.

 /_ah/spi/BackendService.getApiConfigs 200 118ms 8kb 

but no matter what I tried, I always got a 404 Not Found error.

I'm not sure what the problem is, but I think the web server in App Engine redirected all requests to version 1. This could be because both versions had the following settings in their web.xml.

 <servlet-mapping> <servlet-name>SystemServiceServlet</servlet-name> <url-pattern>/_ah/spi/*</url-pattern> </servlet-mapping> 

<b> Solution
I uninstalled version 1 and redid version 2. Then everything just worked perfectly.

+3
source

It comes down to the fact that the default version of the application is different from the one you deployed. Go here: https://appengine.google.com/deployment?app_id=s~your-project-id and change the default version

+3
source

this is because your deployment server is not fully deployed. just redeploy your server and make sure you get the message deployment. You can check the details deployment process on the top page header. Alternatively, you can check by visiting the URL to check:

 https://developers.google.com/apis-explorer/?base=https://[YOUR_PROJECT_ID].appspot.com/_ah/api#p/ 
0
source

Try updating your plugin and dependency libraries to the latest version. See fooobar.com/questions/940775 / ....

0
source

All Articles