9

I run appengine local dev server in eclipse with params 0.0.0.0

When I try to access any of the methods I get the following error. I get the same error if I try to access api explorer

 http://localhost:8888/_ah/api/explorer

Notes: I just updated my app engine server to java 7.

Does anyone know how to fix this problem?

java.io.IOException: Failed to retrieve API configs with status: 500
    at com.google.api.server.spi.tools.devserver.ApiServlet.getApiConfigSources(ApiServlet.java:102)
    at com.google.api.server.spi.tools.devserver.ApiServlet.initConfigsIfNecessary(ApiServlet.java:67)
    at com.google.api.server.spi.tools.devserver.RestApiServlet.service(RestApiServlet.java:117)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.api.socket.dev.DevSocketFilter.doFilter(DevSocketFilter.java:74)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.ResponseRewriterFilter.doFilter(ResponseRewriterFilter.java:123)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:34)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:63)
    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 com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:125)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectRequest(DevAppServerModulesFilter.java:366)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doDirectModuleRequest(DevAppServerModulesFilter.java:349)
    at com.google.appengine.tools.development.DevAppServerModulesFilter.doFilter(DevAppServerModulesFilter.java:116)
    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.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:97)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:487)
    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 org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Sometimes the first line of the error is

java.lang.NoClassDefFoundError: com/google/gwt/core/ext/typeinfo/NotFoundException
CSchulz
  • 10,882
  • 11
  • 60
  • 114
kasavbere
  • 5,873
  • 14
  • 49
  • 72
  • Some source code and a description of what you're trying to do would help someone answer the question. And to eliminate wrong conclusions, also say what works - the [Java Tutorial](https://developers.google.com/appengine/docs/java/gettingstarted/introduction) etcetera. – Martin Berends Feb 22 '14 at 08:39
  • 1
    The Java 6 to Java 7 transition can cause unpredictable problems. It sometimes helps to set up a new development environment (Eclipse etc) that never had any Java 6 in it, and copy only your source files into that. – Martin Berends Feb 22 '14 at 20:57
  • app engine version: `/Applications/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.8.9/appengine-java-sdk-1.8.9`. – kasavbere Feb 22 '14 at 20:58
  • Wow @MartinBerends, that's going to be a lot of work. But thanks for sharing. – kasavbere Feb 22 '14 at 21:06
  • Not only is it lots of work, it's also not sure to help. So good luck with it if you decide to try, and sorry in advance if that does not solve the problem. – Martin Berends Feb 22 '14 at 21:17
  • 1
    +1 I currently face the same issue (see [here](http://stackoverflow.com/questions/24378419/debugging-google-web-application-projects-with-google-cloud-endpoints-in-eclipse)) – Drux Jun 25 '14 at 22:35

4 Answers4

1

I had the same issue and I had to delete my web.xml and redo it via a template. More specifically this section:

servlet-name>SystemServiceServlet</servlet-name>
    <servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
    <init-param>
        <param-name>services</param-name>
        <param-value>YOUR-API-CLASS</param-value>
    </init-param>
</servlet>

Also, make sure that you have your API defined in your API class. Here is just a sample configuration.

@Api(name = "apiname", version = "1.00",
    scopes = (Constants.EMAIL_SCOPE) , clientIds = {
    Constants.WEB_CLIENT_ID,
    Constants.API_EXPLORER_CLIENT_ID },
    description = "API Description")
Jared Mackey
  • 3,998
  • 4
  • 31
  • 50
0

I recently encountered a similar problem, and mine was caused by having public methods with an @ApiMethod. To fix this I re-factored my code to make the methode private. But I could have added a line like this before the new method:

@ApiMethod(name = "yourNewPublicMethod", path = "profile", httpMethod = HttpMethod.POST)
0

I got similar exception. In my case, I just added new entity class and forgot to annotate it with @Entity. And stacktrace looked like:

java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at com.google.api.server.spi.ServletInitializationParameters.getClassForName(ServletInitializationParameters.java:82)
...
Caused by: java.lang.IllegalArgumentException: class com.myapp.entity.Stat must be annotated with either @Entity or @Subclass
at com.googlecode.objectify.impl.Registrar.register(Registrar.java:81)
at com.googlecode.objectify.ObjectifyFactory.register(ObjectifyFactory.java:185)
at com.googlecode.objectify.ObjectifyService.register(ObjectifyService.java:64)
...
Jun 18, 2016 7:13:39 PM com.google.apphosting.utils.jetty.JettyLogger warn
 WARNING: /_ah/api/discovery/v1/apis/userapi/v1/rest: java.io.IOException:      
Failed to retrieve API configs with status: 500
Jun 18, 2016 7:13:39 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /_ah/spi/BackendService.getApiConfigs
java.lang.NullPointerException
at com.google.api.server.spi.SystemServiceServlet.

After I added annotation to class, exception is gone.

Yuriy N.
  • 4,936
  • 2
  • 38
  • 31
0

You must make your development server accessible to the network by setting it to listen to external connections. You can do this by editing the build.gradle for the backend project and setting the httpAddress.

appengine {
  ....
  httpAddress = "0.0.0.0"
  ....
}

You must also change the endpoint root url to point to your computer's ip address when creating the endpoint .

Registration.Builder builder = new Registration.Builder(AndroidHttp.newCompatibleTransport(),
        new AndroidJsonFactory(), null)
        .setRootUrl("http://<my-computer-address>:8080/_ah/api/")
        ....

best reference is here

Lokesh Tiwari
  • 10,496
  • 3
  • 36
  • 45