添加Api管理时出现ServiceConfigException

添加Api管理时出现ServiceConfigException

本文介绍了添加Api管理时出现ServiceConfigException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

尝试将 Api Management 添加到我的项目中后,就像 ServiceConfigException . google.com/endpoints/docs/frameworks/java/adding-api-management"rel =" nofollow noreferrer>在此处进行解释.

I started to get error, ServiceConfigException, after I've tried to add Api Management to my project just as explained here.

web.xml 行中的 ServiceManagementConfigFilter 行注释为在此处告知解决了我的问题,但使我的项目失去了API的支持.

Commenting out ServiceManagementConfigFilter lines from web.xml lines as told here solves my problem but leaves my project without API support.

我很想得到一些帮助.预先感谢.

I'd love to get some help. Thanks in advance.

--------------------------------------------------------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building PROJECT-NAME 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> appengine-maven-plugin:1.3.2:run (default-cli) > package @ PROJECT-NAME >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ PROJECT-NAME ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ PROJECT-NAME ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ PROJECT-NAME ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ PROJECT-NAME ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ PROJECT-NAME ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ PROJECT-NAME ---
[INFO] Packaging webapp
[INFO] Assembling webapp [PROJECT-NAME] in [C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\target\PROJECT-NAME-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp webResources [C:\Users\NAME\Repos\PROJECT-FOLDER\Backend/src/main/webapp/WEB-INF] to [C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\target\PROJECT-NAME-1.0-SNAPSHOT]
[INFO] Copying webapp resources [C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\src\main\webapp]
[INFO] Webapp assembled in [2435 msecs]
[INFO] Building war: C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\target\PROJECT-NAME-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< appengine-maven-plugin:1.3.2:run (default-cli) < package @ PROJECT-NAME <<<
[INFO]
[INFO] --- appengine-maven-plugin:1.3.2:run (default-cli) @ PROJECT-NAME ---
May 03, 2018 1:15:30 AM com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDevServer1 run
INFO: Setting appengine-web.xml configured environment variables: ENDPOINTS_SERVICE_VERSION=2017-04-20r1,ENDPOINTS_SERVICE_NAME=PROJECT-ID.appspot.com
May 03, 2018 1:15:30 AM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logCommand
INFO: submitting command: C:\Program Files\Java\jdk1.8.0_131\jre\bin\java.exe -Duse_jetty9_runtime=true -D--enable_all_permissions=true -Dappengine.sdk.root=C:\Users\NAME\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\java -cp C:\Users\NAME\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\java\lib\appengine-tools-api.jar com.google.appengine.tools.development.DevAppServerMain --allow_remote_shutdown --disable_update_check --no_java_agent C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\target\PROJECT-NAME-1.0-SNAPSHOT
[INFO] GCLOUD: May 03, 2018 1:15:30 AM java.util.prefs.WindowsPreferences <init>
[INFO] GCLOUD: WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[INFO] GCLOUD: May 03, 2018 1:15:30 AM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
[INFO] GCLOUD: INFO: Overwriting system property key 'java.util.logging.config.file', value 'C:\Users\NAME\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\java\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\target\PROJECT-NAME-1.0-SNAPSHOT\WEB-INF\appengine-web.xml'
[INFO] GCLOUD: 2018-05-03 01:15:30.671:INFO::main: Logging initialized @299ms
[INFO] GCLOUD: 2018-05-03 01:15:30.937:INFO:oejs.Server:main: jetty-9.3.18.v20170406
[INFO] GCLOUD: 2018-05-03 01:15:33.340:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=2120ms
[INFO] GCLOUD: May 02, 2018 10:15:33 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
[INFO] GCLOUD: INFO: javax.servlet.ServletContext log: OfyHelper: Init
[INFO] GCLOUD: May 02, 2018 10:15:46 PM com.google.api.control.Client start
[INFO] GCLOUD: INFO: starting com.google.api.control.Client@1c9f0a20
[INFO] GCLOUD: May 02, 2018 10:15:46 PM com.google.api.control.Client initializeFlushing
[INFO] GCLOUD: INFO: creating a scheduler to control flushing
[INFO] GCLOUD: May 02, 2018 10:15:46 PM com.google.api.control.Client initializeFlushing
[INFO] GCLOUD: INFO: scheduling the initial check, report, and quota
[INFO] GCLOUD: 2018-05-03 01:15:46.613:WARN:oejw.WebAppContext:main: Failed startup of context c.g.a.t.d.j.DevAppEngineWebAppContext@5e8f9e2d{/,file:///C:/Users/NAME/Repos/PROJECT-FOLDER/Backend/target/PROJECT-NAME-1.0-SNAPSHOT/,UNAVAILABLE}{C:\Users\NAME\Repos\PROJECT-FOLDER\Backend\target\PROJECT-NAME-1.0-SNAPSHOT}
[INFO] GCLOUD: com.google.api.config.ServiceConfigException: Failed to fetch service config (status code 404)
[INFO] GCLOUD:     at com.google.api.config.ServiceConfigSupplier.fetch(ServiceConfigSupplier.java:143)
[INFO] GCLOUD:     at com.google.api.config.ServiceConfigSupplier.get(ServiceConfigSupplier.java:111)
[INFO] GCLOUD:     at com.google.api.config.ServiceConfigSupplier.get(ServiceConfigSupplier.java:49)
[INFO] GCLOUD:     at com.google.common.base.Suppliers$ExpiringMemoizingSupplier.get(Suppliers.java:227)
[INFO] GCLOUD:     at com.google.api.config.ServiceConfigFetcher.fetch(ServiceConfigFetcher.java:41)
[INFO] GCLOUD:     at com.google.api.control.ServiceManagementConfigFilter$1.load(ServiceManagementConfigFilter.java:33)
[INFO] GCLOUD:     at com.google.api.control.ConfigFilter.init(ConfigFilter.java:87)
[INFO] GCLOUD:     at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:139)
[INFO] GCLOUD:     at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:873)
[INFO] GCLOUD:     at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349)
[INFO] GCLOUD:     at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1406)
[INFO] GCLOUD:     at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1368)
[INFO] GCLOUD:     at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778)
[INFO] GCLOUD:     at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)
[INFO] GCLOUD:     at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:522)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
[INFO] GCLOUD:     at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
[INFO] GCLOUD:     at org.eclipse.jetty.server.Server.start(Server.java:422)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
[INFO] GCLOUD:     at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
[INFO] GCLOUD:     at org.eclipse.jetty.server.Server.doStart(Server.java:389)
[INFO] GCLOUD:     at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:     at com.google.appengine.tools.development.jetty9.JettyContainerService.startContainer(JettyContainerService.java:346)
[INFO] GCLOUD:     at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:284)
[INFO] GCLOUD:     at com.google.appengine.tools.development.AutomaticInstanceHolder.startUp(AutomaticInstanceHolder.java:26)
[INFO] GCLOUD:     at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:87)
[INFO] GCLOUD:     at com.google.appengine.tools.development.Modules.startup(Modules.java:105)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:274)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:219)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:217)
[INFO] GCLOUD:     at java.security.AccessController.doPrivileged(Native Method)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:217)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:368)
[INFO] GCLOUD:     at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:223)
[INFO] GCLOUD:     at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:214)
[INFO] GCLOUD: 2018-05-03 01:15:46.625:INFO:oejs.AbstractConnector:main: Started NetworkTrafficSelectChannelConnector@2cf23c81{HTTP/1.1,[http/1.1]}{localhost:8080}
[INFO] GCLOUD: 2018-05-03 01:15:46.626:INFO:oejs.Server:main: Started @16242ms
[INFO] GCLOUD: May 02, 2018 10:15:46 PM com.google.appengine.tools.development.AbstractModule startup
[INFO] GCLOUD: INFO: Module instance default is running at http://localhost:8080/
[INFO] GCLOUD: May 02, 2018 10:15:46 PM com.google.appengine.tools.development.AbstractModule startup
[INFO] GCLOUD: INFO: The admin console is running at http://localhost:8080/_ah/admin
[INFO] GCLOUD: May 03, 2018 1:15:46 AM com.google.appengine.tools.development.DevAppServerImpl doStart
[INFO] GCLOUD: INFO: Dev App Server is now running

推荐答案

appengine-web.xml 中删除 ENDPOINTS_SERVICE_VERSION 可以神奇地解决了该问题.尽管我不知道它是如何关联的.

Removing the ENDPOINTS_SERVICE_VERSION from appengine-web.xml magically solved the problem. Though I don't know how it is related.

修改:注释掉这些行可以解决问题,但禁用api键支持.

Commenting out these lines solves the problem but disables api key support.

<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>

修改:让我们更深入地说明问题发生的原因.

Let's add a little bit of depth why the problem occurred.

使用gcloud endpoints services deploy openapi.json命令部署openapi.json文件时,它会回显诸如 2017-02-13r0之类的服务配置ID.您应该在appengine-web.xml中将其用作值环境变量 ENDPOINTS_SERVICE_VERSION.

When openapi.json file deployed by using gcloud endpoints services deploy openapi.json command, it echoes a service configuration id like 2017-02-13r0. You should be using that in appengine-web.xml as the value of environment variable ENDPOINTS_SERVICE_VERSION.

由于找到了复制并推送新服务名称,因此相当笨拙的流程(实际上是这样),在cloudendpoint的后期,他们将其更改为(如果未指定)最新版本的 ENDPOINTS_SERVICE_VERSION .

Since, copying and pushing the new service name is found fairly clunky flow (and it really was), on the later stages of cloudendpoints, they changed it to, if not specified any, the latest version of ENDPOINTS_SERVICE_VERSION will be used.

这篇关于添加Api管理时出现ServiceConfigException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 16:27