我使用Google Cloud / Java / Standard AppEngine开始了一个新项目。这个非常简单的项目包含根据Google Cloud Endpoints框架的端点/ API。在云上运行时,一切都按预期工作。在本地运行时,它根本不启动,我在下面得到了这个例外:
juil. 27, 2017 3:37:32 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
INFOS: Overwriting system property key 'java.util.logging.config.file', value 'd:\devtools\CloudSDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\java\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'D:\workspaces\googlecloud\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\jaime-sortir\WEB-INF\appengine-web.xml'
2017-07-27 15:37:32.782:INFO::main: Logging initialized @907ms
2017-07-27 15:37:33.236:INFO:oejs.Server:main: jetty-9.3.18.v20170406
2017-07-27 15:37:37.496:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=3911ms
2017-07-27 15:37:38.133:INFO:oejs.AbstractConnector:main: Started NetworkTrafficSelectChannelConnector@2d6764b2{HTTP/1.1,[http/1.1]}{localhost:8080}
Exception in thread "main" java.lang.IllegalAccessError: com/google/appengine/repackaged/com/google/common/base/Platform
at com.google.appengine.repackaged.com.google.common.base.Ticker$1.read(Ticker.java:69)
at com.google.appengine.repackaged.com.google.common.base.Stopwatch.elapsedNanos(Stopwatch.java:181)
at com.google.appengine.repackaged.com.google.common.base.Stopwatch.elapsed(Stopwatch.java:194)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$LoadingValueReference.elapsedNanos(LocalCache.java:3665)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2381)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2294)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2207)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache.get(LocalCache.java:4062)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4066)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4995)
at com.google.appengine.repackaged.com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5001)
at com.google.appengine.api.appidentity.AppIdentityServiceImpl.getAccessToken(AppIdentityServiceImpl.java:272)
at endpoints.repackaged.com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential.intercept(AppIdentityCredential.java:98)
at endpoints.repackaged.com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential$AppEngineCredentialWrapper.intercept(AppIdentityCredential.java:243)
at endpoints.repackaged.com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
at endpoints.repackaged.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at endpoints.repackaged.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at endpoints.repackaged.com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.fetchLatestServiceVersion(ServiceConfigSupplier.java:154)
at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.fetch(ServiceConfigSupplier.java:125)
at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.get(ServiceConfigSupplier.java:110)
at endpoints.repackaged.com.google.api.config.ServiceConfigSupplier.get(ServiceConfigSupplier.java:49)
at endpoints.repackaged.com.google.common.base.Suppliers$ExpiringMemoizingSupplier.get(Suppliers.java:199)
at endpoints.repackaged.com.google.api.config.ServiceConfigFetcher.fetch(ServiceConfigFetcher.java:41)
at com.google.api.control.ServiceManagementConfigFilter$1.load(ServiceManagementConfigFilter.java:33)
at com.google.api.control.ConfigFilter.init(ConfigFilter.java:87)
at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:139)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:873)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:349)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1406)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1368)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:778)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:262)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:522)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at org.eclipse.jetty.server.Server.start(Server.java:422)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:389)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at com.google.appengine.tools.development.jetty9.JettyContainerService.startContainer(JettyContainerService.java:346)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:284)
at com.google.appengine.tools.development.ManualInstanceHolder.startUp(ManualInstanceHolder.java:77)
at com.google.appengine.tools.development.AbstractModule.startup(AbstractModule.java:87)
at com.google.appengine.tools.development.Modules.startup(Modules.java:105)
at com.google.appengine.tools.development.DevAppServerImpl.doStart(DevAppServerImpl.java:271)
at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:47)
at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:219)
at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:217)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:359)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:47)
at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:223)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:214)
我从Eclispe / Windows 7开始我的本地服务器。根据堆栈跟踪,它在处理Oauth2时会崩溃(API不受限制,但它引用了一些安全对象)。
我一直在谷歌上搜索这个问题而一无所获。我有另一个没有任何端点的示例项目在Windows上正常运行。下面是我的pom.xml
<project>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>zango.jaimesortir</groupId>
<artifactId>jaimesortir-api</artifactId>
<!-- <parent> <artifactId>appengine-java8-samples</artifactId> <groupId>com.google.cloud</groupId>
<version>1.0.0</version> <relativePath>..</relativePath> </parent> -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<endpoints.framework.version>2.0.7</endpoints.framework.version>
<endpoints.management.version>1.0.4</endpoints.management.version>
<endpoints.project.id>xxxxx</endpoints.project.id>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<appengine.maven.plugin>1.3.1</appengine.maven.plugin>
<appengine.version>1.9.54</appengine.version>
<appengine.sdk.version>1.9.54</appengine.sdk.version>
<!-- <project.http.version>1.19.0</project.http.version> <project.oauth.version>1.19.0</project.oauth.version> -->
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>${endpoints.framework.version}</version>
</dependency>
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-management-control-appengine-all</artifactId>
<version>${endpoints.management.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>GetSwaggerDoc</id>
<activation>
<property>
<name>GetSwaggerDoc</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<mainClass>com.google.api.server.spi.tools.EndpointsTool</mainClass>
<arguments>
<argument>get-swagger-doc</argument>
<argument>--hostname=echo-api.endpoints.${endpoints.project.id}.cloud.goog</argument>
<argument>--war=target/jaimesortir-api-1.0-SNAPSHOT</argument>
<argument>zango.jaimesortir.api.LocationApi</argument>
</arguments>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework-tools</artifactId>
<version>${endpoints.framework.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${appengine.sdk.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin}</version>
</plugin>
</plugins>
</build>
</project>
有人可以帮忙吗?
谢谢。
答案 0 :(得分:0)
在发布我的问题之后,我仔细检查了一下,注意到我忘了按照教程
中的说明执行以下命令gcloud auth application-default login
现在,它开始了。感谢任何试图提供帮助的人。