I have an existing multi-module Gradle-based Google App Engine (GAE) project, which was initially based from https://github.com/GoogleCloudPlatform/appengine-modules-sample-java.
The project has Cloud Endpoints for App Engine, and I'm migrating it to Cloud Endpoints Framework ("cloud endpoints version 2"). I followed https://cloud.google.com/endpoints/docs/frameworks/java/required_files, which means I changed these:
build.gradle
+ compile 'com.google.endpoints:endpoints-framework-auth:1.0.0-beta.10'
+ compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.0-beta.10'
appengine-web.xml
+ <env-variables>
+ <env-var name="ENDPOINTS_SERVICE_NAME" value="myproject.appspot.com" />
+ </env-variables>
web.xml
+ <!-- Endpoints service config from service management -->
+ <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>api</servlet-name>
+ </filter-mapping>
+
+ <!-- Endpoints logging and monitoring -->
+ <filter>
+ <filter-name>endpoints-api-controller</filter-name>
+ <filter-class>com.google.api.control.extensions.appengine.GoogleAppEngineControlFilter</filter-class>
+ <init-param>
+ <param-name>endpoints.projectId</param-name>
+ <param-value>myproject</param-value>
+ </init-param>
+ <init-param>
+ <param-name>endpoints.serviceName</param-name>
+ <param-value>myproject.appspot.com</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>endpoints-api-controller</filter-name>
+ <servlet-name>api</servlet-name>
+ </filter-mapping>
(I've done the part in https://cloud.google.com/appengine/docs/java/endpoints/migrating which I will not discuss here)
But I encounter this error when trying to run it using "gradle appengineRun":
Oct 24, 2016 8:53:12 AM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFO: Overwriting system property key 'java.util.logging.config.file', value '/Users/username/.gradle/appengine-sdk/appengine-java-sdk-1.9.42/config/sdk/logging.properties' with value 'WEB-INF/logging.properties' from '/Users/username/Documents/code/myproject/web/ear/build/exploded-app/default-1.0/WEB-INF/appengine-web.xml'
Oct 24, 2016 8:53:12 AM com.google.appengine.tools.development.DevAppServerImpl <init>
INFO: Ignoring application.xml context-root element, for details see https://developers.google.com/appengine/docs/java/modules/#config
com.google.appengine.tools.development.EnvironmentVariableChecker$IncorrectEnvironmentVariableException: One or more environment variables have been configured in appengine-web.xml that have missing or different values in your local environment. We recommend you use system properties instead, but if you are interacting with legacy code that requires specific environment variables to have specific values, please set these environment variables in your environment before running.
[Mismatch environmentVariableName=ENDPOINTS_SERVICE_NAME environmentVariableValue=null appEngineWebXmlValue=myproject.appspot.com appEngineWebXmlFile=/Users/username/Documents/code/myproject/web/ear/build/exploded-app/default-1.0/WEB-INF/appengine-web.xml]
at com.google.appengine.tools.development.EnvironmentVariableChecker.check(EnvironmentVariableChecker.java:75)
at com.google.appengine.tools.development.ApplicationConfigurationManager.checkEnvironmentVariables(ApplicationConfigurationManager.java:240)
at com.google.appengine.tools.development.ApplicationConfigurationManager.access$000(ApplicationConfigurationManager.java:32)
at com.google.appengine.tools.development.ApplicationConfigurationManager$EarModuleConfigurationHandle.checkEnvironmentVariables(ApplicationConfigurationManager.java:486)
at com.google.appengine.tools.development.JettyContainerService.connectContainer(JettyContainerService.java:213)
at com.google.appengine.tools.development.AbstractContainerService.createConnection(AbstractContainerService.java:269)
at com.google.appengine.tools.development.AbstractInstanceHolder.createConnection(AbstractInstanceHolder.java:37)
at com.google.appengine.tools.development.AbstractModule.createConnection(AbstractModule.java:73)
at com.google.appengine.tools.development.Modules.createConnections(Modules.java:99)
at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:239)
at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:45)
at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:217)
at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:215)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:215)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:277)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:225)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:216)
How do I fix this?