GeezerVison is showing github.com — Quickstart for Cloud Endpoints Frameworks on App Engine is not working · Issue #533 · GoogleCloudPlatform/java-docs-samples
Quickstart for Cloud Endpoints Frameworks on App Engine is not working #533DescriptionIn which file did you encounter the issue?
Could not run the endpoints framework quick start
https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java
I have tried with maven 3.0 as well as 3.3.9 as there was a log pointing to the minimum version of maven but the issue still persists.
Apache Maven 3.0 (r1004208; 2010-10-04 17:20:56+0530)
Java version: 1.8.0_66
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x" version: "10.12.3" arch: "x86_64" Family: "mac"
Did you change the file? If so, how?
No.
Describe the issue
Not able to generate openApi config spec using
mvn exec:java -DGetSwaggerDoc
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project echo: An exception occured while executing the Java class. null: InvocationTargetException: org/slf4j/helpers/NOPLoggerFactory: org.slf4j.helpers.NOPLoggerFactory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project echo: An exception occured while executing the Java class. null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null
at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:345)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
... 19 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/slf4j/helpers/NOPLoggerFactory
at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:70)
at org.slf4j.impl.StaticLoggerBinder.(StaticLoggerBinder.java:44)
at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
at io.swagger.models.parameters.AbstractSerializableParameter.(AbstractSerializableParameter.java:23)
at com.google.api.server.spi.swagger.SwaggerGenerator.writeApiMethod(SwaggerGenerator.java:234)
at com.google.api.server.spi.swagger.SwaggerGenerator.writeApiClass(SwaggerGenerator.java:216)
at com.google.api.server.spi.swagger.SwaggerGenerator.writeApi(SwaggerGenerator.java:199)
at com.google.api.server.spi.swagger.SwaggerGenerator.writeSwagger(SwaggerGenerator.java:179)
at com.google.api.server.spi.swagger.SwaggerGenerator.writeSwagger(SwaggerGenerator.java:158)
at com.google.api.server.spi.tools.GetOpenApiDocAction.genOpenApiDoc(GetOpenApiDocAction.java:123)
at com.google.api.server.spi.tools.GetOpenApiDocAction.execute(GetOpenApiDocAction.java:82)
at com.google.api.server.spi.tools.EndpointsTool.execute(EndpointsTool.java:84)
at com.google.api.server.spi.tools.EndpointsTool.main(EndpointsTool.java:116)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.helpers.NOPLoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 24 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Activityfrankyn commented on Feb 22, 2017 Hi @mouli1382 ,
Thanks for raising this issue.
There's a PR in review that will help resolve this issue.
For now you can modify the pom.xml by changing endpoints-framework-all to endpoints-framework on Line: 53. mouli1382 commented on Feb 22, 2017 Thanks @frankyn. I could test the API when deployed to app engine but facing some issues with locally running server.
[INFO] GCLOUD: INFO 2017-02-22 09:03:17,301 api_server.py:268] Starting API server at: http://localhost:52862
[INFO] GCLOUD: INFO 2017-02-22 09:03:17,311 dispatcher.py:199] Starting module "default" running at: http://localhost:8080
[INFO] GCLOUD: INFO 2017-02-22 09:03:17,313 admin_server.py:116] Starting admin server at: http://localhost:8000
curl -H "Content-Type: application/json" -X POST -d '{"message":"echo"}' http://localhost:52862/_ah/api/echo/v1/echo
Tcexceptions
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 301, in _handle_POST
[INFO] GCLOUD: request.ParseFromString(wsgi_input)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 140, in ParseFromString
[INFO] GCLOUD: self.MergeFromString(s)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 152, in MergeFromString
[INFO] GCLOUD: self.MergePartialFromString(s)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 168, in MergePartialFromString
[INFO] GCLOUD: self.TryMerge(d)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_pb.py", line 210, in TryMerge
[INFO] GCLOUD: d.skipData(tt)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 669, in skipData
[INFO] GCLOUD: self.skipData(t)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 662, in skipData
[INFO] GCLOUD: self.skip(n)
[INFO] GCLOUD: File "../Downloads/google-cloud-sdk/platform/google_appengine/google/net/proto/ProtocolBuffer.py", line 650, in skip
[INFO] GCLOUD: if self.idx + n > self.limit: raise ProtocolBufferDecodeError, "truncated"
[INFO] GCLOUD: ProtocolBufferDecodeError: truncated
Could you help me fix this? frankyn commented on Feb 22, 2017 I'm still looking into this, and you may wish to try the following. Let me know how it works. I'll reply here as soon as I find a better answer.
- git pull # the PR was merged from my first response.
- In pom.xml substitute YOUR_PROJECT_ID for your Google Cloud Platform project id
- mvn exec:java -DGetSwaggerDoc
- gcloud service-management deploy openapi.json
- mvn appengine:run
- curl -X POST -H "Content-Type: application/json" -d '{"message":"echo"}' \
http://localhost:8080/_ah/api/echo/v1/echo
lukegeor commented on Mar 21, 2017 Hi,
I see the original author didn't reply, but I'm seeing the same problem he saw when running locally. I'm on Windows 10, and I ran through the quickstart, which has the exact same steps you listed in your last comment except for the curl command. Question, though. Are you supposed to connect to port 8080, or the port that's listed in your console as the API server? I've tried both. The API server port responds with the protobuf error, and port 8080 responds with a 500 error and "bad runtime process port['']"
Thanks. frankyn commented on Mar 22, 2017 Hi @lukegeor,
The sample should be using port 8080 for local tests. I have a few follow up questions.
- Which version of the Cloud SDK are you using?
gcloud -v.
- You can update the Cloud SDK using
gcloud components update
- Did you recently clone this repository? We update dependencies often.
- Could you add the console output containing the error?
- Can you add the
pom.xml you're using?
Thank you! lukegeor commented on Mar 22, 2017 Thanks for the response, Frank. I'm going to try one more time. I do
notice, however, that the line in the quickstart that says:
export ENDPOINTS_SERVICE_NAME=echo-api-flex.endpoints.[YOUR_PROJECT_ID].cloud.goog
should not have the "-flex" in it as the service name that gets deployed is
named echo-api.endpoints.[YOUR_PROJECT_ID].cloud.goog. I'm going to change
this when I try again.
…lukegeor commented on Mar 22, 2017 Also, you need to make sure to have users install the app-engine-python and
app-engine-java components.
…
On Wed, Mar 22, 2017 at 2:02 PM, Luke Georgalas ***@***.***> wrote:
Thanks for the response, Frank. I'm going to try one more time. I do
notice, however, that the line in the quickstart that says:
export ENDPOINTS_SERVICE_NAME=echo-api-flex.endpoints.[YOUR_PROJECT_ID].cloud.goog
should not have the "-flex" in it as the service name that gets deployed
is named echo-api.endpoints.[YOUR_PROJECT_ID].cloud.goog. I'm going to
change this when I try again.
On Wed, Mar 22, 2017 at 10:20 AM, Frank Natividad <
***@***.***> wrote:
> Reopened #533
> < #533>.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> < #533 (comment)>,
> or mute the thread
> < https://github.com/notifications/unsubscribe-auth/AHqLfkQO9t8XU7-sBUAJSUKJpHYS6J4Eks5roVh6gaJpZM4MIRaC>
> .
>
frankyn commented on Mar 22, 2017 Thanks for your feedback, @lukegeor ! Please keep me posted. lukegeor commented on Mar 23, 2017 Frank,
After re-running through the quickstart, I'm still having trouble. Last
time, even if everything was working properly, I was connecting to the
wrong port. Now, I'm connecting to port 8080. When running my curl command
(which I've pasted below), I get a 503 error (timeout).
curl -H "Content-Type: application/json" -X POST -d '{"message":
"echo1"}' http://localhost:8080/_ah/api/echo/v1/echo
The pastebin url below is what I'm seeing on the server.
http://pastebin.com/PDGjCysE
Starting at line 65, I'm getting an error where it can't get information
about the endpoints service. When I run gcloud service-management list, I
get the following output:
<my username> @dev:~/java-docs-samples/appengine/endpoints-frameworks-v2/backend$
gcloud service-management list
NAME
TITLEbigquery-json.googleapis.com BigQuery
APIclouddebugger.googleapis.com Stackdriver Debugger
APIdatastore.googleapis.com Google Cloud Datastore
APIstorage-component.googleapis.com Google Cloud
Storagecontainer.googleapis.com Google Container
Engine APIstorage-api.googleapis.com Google Cloud
Storage JSON APIdataproc-control.googleapis.com Google
Cloud Dataproc Control APIlogging.googleapis.com
Stackdriver Logging APIresourceviews.googleapis.com
Google Compute Engine Instance Groups APIreplicapool.googleapis.com
Google Compute Engine Instance Group Manager
APIcloudapis.googleapis.com Google Cloud
APIsdeploymentmanager.googleapis.com Google Cloud
Deployment Manager V2 APIendpoints.googleapis.com
Google Cloud Endpointsmonitoring.googleapis.com
Stackdriver Monitoring APIservicecontrol.googleapis.com
Google Service Control APIsql-component.googleapis.com
Google Cloud SQLcloudtrace.googleapis.com
Stackdriver Trace APIdataproc.googleapis.com
Google Cloud Dataproc APIservicemanagement.googleapis.com
Google Service Management API*echo-api.endpoints.<project
id>.cloud.goog echo-api.endpoints.<project
id>.cloud.goog*compute-component.googleapis.com Google
Compute Engine APIreplicapoolupdater.googleapis.com Google
Compute Engine Instance Group Updater API
So the endpoints service is definitely registered. I have my cloud sdk set
to authenticate using my gmail account, which is the same gmail account I
used to set up my project. I do have the ENDPOINTS_SERVICE_NAME environment
variable set to the service name above. I can't think of anything else I
might be doing wrong. Any ideas? I think the person who wrote the following
on stackoverflow is having the same problem.
http://stackoverflow.com/questions/42421042/com-google-api-config-serviceconfigsupplier-failed-to-fetch-default-config-ver
Thanks,
Luke
…frankyn commented on Mar 23, 2017 Luke,
Thanks for bringing up the stackoverflow question. I'll make sure to Can you send me your current pom.xml? Have you updated the gcloud tool, I wasn't sure if you did.
The extra -flex was fixed yesterday, thanks for pointing that out.
Thanks! lukegeor commented on Mar 23, 2017 Yes, I have the latest gcloud tool.
Google Cloud SDK 148.0.0
app-engine-java 1.9.50
app-engine-python 1.9.50
bq 2.0.24
bq-nix 2.0.24
core 2017.03.17
core-nix 2016.11.07
gcloud
gcloud-deps 2017.03.17
gcloud-deps-linux-x86_64 2017.02.21
gsutil 4.23
gsutil-nix 4.18
Thanks,
Luke
…frankyn commented on Mar 24, 2017 Could you add your Maven pom.xml? Unless it's the exact same version we currently have. frankyn commented on Mar 24, 2017 Thanks Luke!
That's it. I'll need to test it on a Windows machine next as it works on a Linux machine. I'll keep you posted.
Thanks for bring this up! Sorry for the inconvenience. I really appreciate your patience. lukegeor commented on Mar 24, 2017 You're able to get it working in Linux? That's where I'm testing now and
it's not working for me. I meant that I'm traditionally a windows guy. I'm
using whatever the latest version of Ubuntu you guys have on Google compute
engine.
…frankyn commented on Mar 24, 2017 Thanks for adding the environment you're using. I'm currently debugging as I was able to reproduce the issue you're seeing.
I'll keep you posted. frankyn commented on Mar 25, 2017 I was able to get past this error by using the following command:
gcloud auth application-default login
Let me know if that helps run it locally. Reacted by Henry Lawson and Margaret Wambui Garachu lukegeor commented on Mar 25, 2017 Exactly what does that command do? From what I can see, it allows a local
service account access to GCP. If I were to run gcloud config set account
<my email address, which I also used to set up my GCP project>, why doesn't
that allow my app to access my cloud resources? Does that only apply to
gcloud commands, but not to calls to GCP from my running service?
Anyway, looks like that did the trick. However, the first request had a
failure. After that first error, I did see a message that the Dev App
Server was running. So I ran my curl command again and got the expected
result. Not sure if you consider that a 100% success, but at least it's
working. Thanks for all your help. Looking forward to writing some code now!
Thanks again,
Luke
…frankyn commented on Mar 30, 2017 Hi @lukegeor,
This was a permission issue. When you first create a compute engine instance you’re given a choice to select the Access Scope provided. By default the Access Scope is set to Allow default access, which doesn’t provide necessary permission to use the Endpoints API. Default access scope states: “read-only access to Storage and Service Management, write access to Stackdriver Logging and Monitoring, read/write access to Service Control.”
You can learn more about Access Scope of a Compute Engine instance at
https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes
As for the command gcloud auth application-default login. According to the help description:
Obtains user access credentials via a web flow and puts them in the well-known location for
Application Default Credentials to use them as a proxy for a service account.
When you used this command it obtains credentials for gcloud your Gmail Account. [email protected] and then stores the credentials in a location known to contain application credentials.
You can setup a service account using the Cloud SDK gcloud at https://cloud.google.com/sdk/docs/authorizing
Please let me know if you have anymore questions. Thanks for reopening this issue.
I will forward the issue with the first call. I'm seeing the same issue on my end.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|