I normally use Google Cloud Endpoints on the AppEngine (Java) , as described in :
https://cloud.google.com/appengine/docs/java/endpoints/helloendpoints-java-maven
The dependency for the endpoints library I use is :
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-endpoints</artifactId>
<version>1.9.48</version>
</plugin>
Using this, I can start a local development server using the command: mvn clean package appengine:devserver
However, there seems to be a new version of cloud endpoints. https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java .
The new framework is found here
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>${endpoints.framework.version}</version>
</dependency>
The same maven commands do not work here. I am unable to start a local dev server, open the API explorer or use a local datastore (all of which was possible earlier) . Could someone please guide me on how to work with the new framework.
Also, is the former framework likely to be deprecated ?
Endpoints is an API management system that helps you secure, monitor, analyze, and set quotas on your APIs using the same infrastructure Google uses for its own APIs.
App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, and then let App Engine take care of provisioning servers and scaling your app instances based on demand.
To answer my own question partially : I could finally get the "Echo application" (mentioned in https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java) to work
But I had to make 2 changes: a) Comment out the block in appengine-web.xml . ie,
<!--
<basic-scaling>
<max-instances>2</max-instances>
</basic-scaling>
-->
After doing this, I got a different error, "failed endpoints-api-configuration: com.google.api.config.ServiceConfigException: Failed to fetch default config version for service" To get around this :
b) Comment out the ServiceManagementConfigFilter from web.xml , ie,
<!--
<filter>
<filter-name>endpoints-api-configuration</filter-name>
<filter-class>com.google.api.control.ServiceManagementConfigFilter</filter-class>
</filter>
-->
<!--
<filter-mapping>
<filter-name>endpoints-api-configuration</filter-name>
<servlet-name>EndpointsServlet</servlet-name>
</filter-mapping>
-->
After this,
To build : mvn clean package
To run locally : appengine-java-sdk/1.9.44/appengine-java-sdk/appengine-java-sdk-1.9.44/bin/dev_appserver.sh /path/to/war/directory
It would be great if someone could shed more light on implication of these changes, and on how we could get it to work out of the box
There are a few problems you are running into and this stuff is overly sensitive to configuration issues:
To solve the problems follow the instructions in: https://cloud.google.com/endpoints/docs/frameworks/java/quickstart-frameworks-java
If the project id is not valid (actually exists in AppEngine) the next steps won't work
mvn exec:java -DGetSwaggerDoc
gcloud service-management deploy openapi.json
export ENDPOINTS_SERVICE_NAME=echo-api.endpoints.<your project id>.cloud.goog
The quickstart guide is not very helpful for step 5. Step 4 needs to end with a success message.
Finally the sample comes with a Maven plugin that does not seem to work with the new Endpoints. Instead of using:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>
use:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.44</version>
</plugin>
The answer to the question why mvn appengine:devserver doesn't work is that the devserver target doesn't exist in the new plugin. The old Maven plugin allows you to execute: mvn appengine:devserver
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With