Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
caitlyn-organizer opened this issue Nov 18, 2017 · 2 comments
Assignees

Comments

@caitlyn-organizer
Copy link

caitlyn-organizer commented Nov 18, 2017

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

@frankyn
Copy link
Member

frankyn commented Nov 18, 2017

Hi @caitlyn-organizer,

Are you running a specific sample?
If you're running the sample detailed here https://cloud.google.com/endpoints/docs/frameworks/java/get-started-frameworks-java then you should use the following updated commands for each action (the doc mentioned contain bugs and we are working on resolving them):

Set the Google Cloud Project id in the pom.xml. This will update the value found in the appengine-web.xml.

Then run the following commands:

gcloud config set project projectid
gcloud auth application-default login
mvn clean package
mvn endpoints-framework:openApiDocs
gcloud endpoints services deploy target/openapi-docs/openapi.json
mvn appengine:run

@frankyn frankyn self-assigned this Nov 18, 2017
@frankyn
Copy link
Member

frankyn commented May 28, 2019

Closing as issue hasn't been updated in over a year.

@frankyn frankyn closed this as completed May 28, 2019
minherz pushed a commit that referenced this issue Nov 9, 2022
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
minherz pushed a commit that referenced this issue Nov 10, 2022
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
minherz pushed a commit that referenced this issue Nov 10, 2022
🤖 I have created a release *beep* *boop*
---


### Updating meta-information for bleeding-edge SNAPSHOT release.

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
anguillanneuf pushed a commit that referenced this issue Nov 15, 2022
…922)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 457524730

Source-Link: googleapis/googleapis@917e7f2

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2497f9a069d3f6b2d6810d5a4e239cda1e7e5a39
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjQ5N2Y5YTA2OWQzZjZiMmQ2ODEwZDVhNGUyMzljZGExZTdlNWEzOSJ9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants