title: Google Cloud Endpoints API Gets 404
body: <p><strong>Environment</strong><br>
  I'm running AppEngine Cloud Endpoints with a Bootstrap JavaScript UI and a Google SQL Datastore.</p>
  
  <p><strong>Problem</strong><br>
  When the Javascript calls gapi.client.load it gets a 404.  The API Explorer works and the JavaScript works when run locally... It's just when trying to load the API via JavaScript that I get the failure.</p>
  
  <p>Here's the error as it appears in Chrome:</p>
  
  <pre><code>GET https://MyAppID.appspot.com/_ah/api/discovery/v1/apis/myAP…%2Cversion%2CrootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods&amp;pp=0 404       ()
  zu @ cb=gapi.loaded_0:83
  n @ cb=gapi.loaded_0:83C
  u @ cb=gapi.loaded_0:83
  (anonymous function) @ cb=gapi.loaded_0:84
  g @ cb=gapi.loaded_0:55
  c @ cb=gapi.loaded_0:46
  </code></pre>
  
  <p>It's then followed by another exception of "Cannot read property" because it can't find the method within the API that it didn't load.</p>
  
  <p><strong>Code</strong></p>
  
  <p>The code for my index.html page:<br></p>
  
  <pre><code>        function init() 
          {
  
              apisToLoad = 2;
  
              var callback = function() 
              {
                  if (--apisToLoad == 0) 
                  {
                        signin(true, userAuthed);
                     }
              }
  
              gapi.client.load('oauth2', 'v2', callback);
              //LOCALCHANGE (SWITCH BETWEEN LOCAL AND NOT)
              gapi.client.load('myAPI', 'v1', callback, 'https://MyAppId.appspot.com/_ah/api');
              //gapi.client.load('myAPI', 'v1', callback, 'http://localhost:8080/_ah/api');
  
          }
  </code></pre>
  
  <p>I think that's right, so I'm also going to include my appengine.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;appengine-web-app xmlns="http://appengine.google.com/ns/1.0"&gt;
  &lt;application&gt;MyAppID&lt;/application&gt;
  &lt;version&gt;1&lt;/version&gt;
  &lt;threadsafe&gt;true&lt;/threadsafe&gt;
  &lt;use-google-connector-j&gt;true&lt;/use-google-connector-j&gt;
  
  &lt;system-properties&gt;
      &lt;property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/&gt;
  &lt;/system-properties&gt;
  &lt;/appengine-web-app&gt;
  </code></pre>
  
  <p>and my web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" standalone="no"?&gt;&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt;
  &lt;servlet&gt;
      &lt;servlet-name&gt;SystemServiceServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.google.api.server.spi.SystemServiceServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;services&lt;/param-name&gt;
          &lt;param-value&gt;com.lthoi.myAPI&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;SystemServiceServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/_ah/spi/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;welcome-file-list&gt;
      &lt;welcome-file&gt;index.html&lt;/welcome-file&gt;
  &lt;/welcome-file-list&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>If anyone can think of anywhere else that the error could be, I'd be happy to paste other files.</p>