Skip to content

Cloud Endpoints Frameworks for Java - Running and testing API backends locally not working #922

@caitlyn-organizer

Description

@caitlyn-organizer

In which file did you encounter the issue?

https://cloud.google.com/endpoints/docs/frameworks/java/test-deploy#running_and_testing_api_backends_locally

Did you change the file? If so, how?

I first tried what was in the doc. But that didn't work and after some googling and finding this issue thread #533, I tried the following:
export ENDPOINTS_SERVICE_NAME=endpointname-api.endpoints.projectid.goog
gcloud config set project projectid
gcloud auth application-default login
mvn clean package
mvn exec:java -DGetSwaggerDoc
gcloud service-management deploy openapi.json
mvn appengine:devserver

Describe the issue

I get the exception below when running mvn appengine:devserver and a 503 when attempting to access http://localhost:8080/_ah/api/explorer or http://localhost:8080/_ah/admin. An important note is that this service is not the default service in the appengine project. Its appengine-web.xml service tag is campaign-service. I'm wondering if the instructions for running api backends locally is different for an appengine service other than default.

[INFO] WARNING: failed endpoints-api-configuration: java.lang.IllegalStateException: could not get credentials for fetching service config!
[INFO] Nov 18, 2017 1:16:38 AM com.google.apphosting.utils.jetty.JettyLogger warn
[INFO] WARNING: Failed startup of context com.google.appengine.tools.development.DevAppEngineWebAppContext@7ce026d3{/,/Users/organizer/Development/repos/orgRepos/campaign-service/target/campaign-service-1.0.0-SNAPSHOT}
[INFO] java.lang.IllegalStateException: could not get credentials for fetching service config!
[INFO] at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.create(ServiceConfigSupplier.java:206)
[INFO] at endpoints.repackaged.com.google.api.config.ServiceConfigFetcher.create(ServiceConfigFetcher.java:45)
[INFO] at com.google.api.control.ServiceManagementConfigFilter$1.load(ServiceManagementConfigFilter.java:33)
[INFO] at com.google.api.control.ConfigFilter.init(ConfigFilter.java:87)
[INFO] at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
[INFO] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[INFO] at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
[INFO] at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
[INFO] at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
[INFO] at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
[INFO] at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
[INFO] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[INFO] at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
[INFO] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[INFO] at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
[INFO] at org.mortbay.jetty.Server.doStart(Server.java:224)
[INFO] at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
[INFO] at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:268)
[INFO] at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:284)
[INFO] at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26)
[INFO] at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:87)
[INFO] at com.google.appengine.tools.development.Modules.startup(Modules.java:105)
[INFO] at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:274)
[INFO] at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
[INFO] at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:219)
[INFO] at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:217)
[INFO] at java.security.AccessController.doPrivileged(Native Method)
[INFO] at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:217)
[INFO] at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:368)
[INFO] at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:47)
[INFO] at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:223)
[INFO] at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:214)
[INFO]
[INFO] Nov 18, 2017 1:16:38 AM com.google.apphosting.utils.jetty.JettyLogger info
[INFO] INFO: Started SelectChannelConnector@localhost:8080
[INFO] Nov 18, 2017 1:16:38 AM com.google.appengine.tools.development.JettyContainerService startHotDeployScanner
[INFO] INFO: Full scan of the web app in place every 5s.
[INFO] Nov 18, 2017 1:16:38 AM com.google.appengine.tools.development.AbstractModule startup
[INFO] INFO: Module instance campaign-service is running at http://localhost:8080/
[INFO] Nov 18, 2017 1:16:38 AM com.google.appengine.tools.development.AbstractModule startup
[INFO] INFO: The admin console is running at http://localhost:8080/_ah/admin
[INFO] Nov 17, 2017 5:16:38 PM com.google.appengine.tools.development.DevAppServerImpl doStart
[INFO] INFO: Dev App Server is now running

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions