使用Spring Boot执行Google Cloud App时出现问题

时间:2019-12-28 19:03:48

标签: java spring spring-boot google-app-engine google-cloud-platform

我搜索了很多帖子,但现在整天都无法解决此问题...

我试图以标准模式制作一个Google App Engine应用并使用Spring boot,但是当我尝试访问应该起作用的网址时遇到以下错误:

HTTP ERROR 503
Problem accessing /. Reason:

    Service Unavailable
Powered by Jetty:// 9.4.18.v20190429

我已按照this教程进行尝试...

我尝试将Jetty添加为依赖项,但不起作用,使用树脂制成的Google SDK,但不起作用,删除了tomcat服务器,但也不起作用...

我已将文件夹中的所有内容上载到this repo,以防需要检查。

这是我运行mvn appengine:run的日志:

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------------< com.cloud:demo >---------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] >>> appengine-maven-plugin:1.3.1:run (default-cli) > package @ demo >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/ulises/demo/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ demo ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.cloud.demo.DemoApplicationTests
19:59:53.452 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.cloud.demo.DemoApplicationTests]
19:59:53.456 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
19:59:53.464 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
19:59:53.481 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.cloud.demo.DemoApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
19:59:53.491 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.cloud.demo.DemoApplicationTests], using SpringBootContextLoader
19:59:53.494 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.cloud.demo.DemoApplicationTests]: class path resource [com/cloud/demo/DemoApplicationTests-context.xml] does not exist
19:59:53.494 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.cloud.demo.DemoApplicationTests]: class path resource [com/cloud/demo/DemoApplicationTestsContext.groovy] does not exist
19:59:53.495 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.cloud.demo.DemoApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
19:59:53.495 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.cloud.demo.DemoApplicationTests]: DemoApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
19:59:53.528 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.cloud.demo.DemoApplicationTests]
19:59:53.602 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/home/ulises/demo/target/classes/com/cloud/demo/DemoApplication.class]
19:59:53.603 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.cloud.demo.DemoApplication for test class com.cloud.demo.DemoApplicationTests
19:59:53.685 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.cloud.demo.DemoApplicationTests]: using defaults.
19:59:53.686 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
19:59:53.694 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/TransactionDefinition]
19:59:53.695 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
19:59:53.695 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@15eb5ee5, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@2145b572, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@39529185, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@72f926e6, org.springframework.test.context.support.DirtiesContextTestExecutionListener@3daa422a, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@31c88ec8, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1cbbffcd, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@27ce24aa, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@481a996b, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@3d51f06e]
19:59:53.696 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.cloud.demo.DemoApplicationTests]
19:59:53.696 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.cloud.demo.DemoApplicationTests]
19:59:53.697 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.cloud.demo.DemoApplicationTests]
19:59:53.697 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.cloud.demo.DemoApplicationTests]
19:59:53.698 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.cloud.demo.DemoApplicationTests]
19:59:53.698 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.cloud.demo.DemoApplicationTests]
19:59:53.701 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@72057ecf testClass = DemoApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@1afd44cb testClass = DemoApplicationTests, locations = '{}', classes = '{class com.cloud.demo.DemoApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@67205a84, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@2a17b7b6, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@1e965684, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@4232c52b], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
19:59:53.701 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.cloud.demo.DemoApplicationTests]
19:59:53.701 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.cloud.demo.DemoApplicationTests]
19:59:53.718 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.1.11.RELEASE)

2019-12-28 19:59:53.939  INFO 19078 --- [           main] com.cloud.demo.DemoApplicationTests      : Starting DemoApplicationTests on ulises-laptop with PID 19078 (started by ulises in /home/ulises/demo)
2019-12-28 19:59:53.942  INFO 19078 --- [           main] com.cloud.demo.DemoApplicationTests      : No active profile set, falling back to default profiles: default
2019-12-28 19:59:55.052  INFO 19078 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-12-28 19:59:55.267  INFO 19078 --- [           main] com.cloud.demo.DemoApplicationTests      : Started DemoApplicationTests in 1.542 seconds (JVM running for 2.143)
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.039 s - in com.cloud.demo.DemoApplicationTests
2019-12-28 19:59:55.422  INFO 19078 --- [       Thread-2] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-war-plugin:3.2.3:war (default-war) @ demo ---
[INFO] Packaging webapp
[INFO] Assembling webapp [demo] in [/home/ulises/demo/target/demo-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/ulises/demo/src/main/webapp]
[INFO] Webapp assembled in [59 msecs]
[INFO] Building war: /home/ulises/demo/target/demo-0.0.1-SNAPSHOT.war
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.11.RELEASE:repackage (repackage) @ demo ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] <<< appengine-maven-plugin:1.3.1:run (default-cli) < package @ demo <<<
[INFO] 
[INFO] 
[INFO] --- appengine-maven-plugin:1.3.1:run (default-cli) @ demo ---
Dec 28, 2019 7:59:57 PM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logCommand
INFO: submitting command: /usr/lib/jvm/java-8-oracle/jre/bin/java -Duse_jetty9_runtime=true -D--enable_all_permissions=true -Dappengine.sdk.root=/home/ulises/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java -cp /home/ulises/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 /home/ulises/demo/target/demo-0.0.1-SNAPSHOT
[INFO] GCLOUD: 2019-12-28 19:59:57.951:INFO::main: Logging initialized @415ms to org.eclipse.jetty.util.log.StdErrLog
[INFO] GCLOUD: 2019-12-28 19:59:57.994:WARN:oejs.AbstractConnector:main: Ignoring deprecated socket close linger time
[INFO] GCLOUD: Dec 28, 2019 6:59:58 PM com.google.appengine.tools.development.IsolatedAppClassLoader checkWorkingDirectory
[INFO] GCLOUD: WARNING: Your working directory, (/home/ulises/demo) is not equal to your 
[INFO] GCLOUD: web application root (/home/ulises/demo/target/demo-0.0.1-SNAPSHOT)
[INFO] GCLOUD: You will not be able to access files from your working directory on the production server.
[INFO] GCLOUD: 
[INFO] GCLOUD: 2019-12-28 19:59:58.241:INFO:oejs.Server:main: jetty-9.4.18.v20190429; built: 2019-04-29T20:42:08.989Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_201-b09
[INFO] GCLOUD: 2019-12-28 19:59:58.956:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=544ms
[INFO] GCLOUD: Dec 28, 2019 6:59:59 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
[INFO] GCLOUD: INFO: javax.servlet.ServletContext log: 2 Spring WebApplicationInitializers detected on classpath
[INFO] GCLOUD: 
[INFO] GCLOUD:   .   ____          _            __ _ _
[INFO] GCLOUD:  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
[INFO] GCLOUD: ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[INFO] GCLOUD:  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
[INFO] GCLOUD:   '  |____| .__|_| |_|_| |_\__, | / / / /
[INFO] GCLOUD:  =========|_|==============|___/=/_/_/_/
[INFO] GCLOUD:  :: Spring Boot ::       (v2.1.11.RELEASE)
[INFO] GCLOUD: 
[INFO] GCLOUD: 2019-12-28 18:59:59.579  INFO 19117 --- [           main] com.cloud.demo.ServletInitializer        : Starting ServletInitializer on ulises-laptop with PID 19117 (/home/ulises/demo/target/demo-0.0.1-SNAPSHOT/WEB-INF/classes started by ulises in /home/ulises/demo)
[INFO] GCLOUD: 2019-12-28 18:59:59.584  INFO 19117 --- [           main] com.cloud.demo.ServletInitializer        : No active profile set, falling back to default profiles: default
[INFO] GCLOUD: Dec 28, 2019 7:00:00 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
[INFO] GCLOUD: INFO: javax.servlet.ServletContext log: Initializing Spring embedded WebApplicationContext
[INFO] GCLOUD: 2019-12-28 19:00:00.347  INFO 19117 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 655 ms
[INFO] GCLOUD: 2019-12-28 19:00:00.817  INFO 19117 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
[INFO] GCLOUD: 2019-12-28 19:00:01.031  INFO 19117 --- [           main] com.cloud.demo.ServletInitializer        : Started ServletInitializer in 1.937 seconds (JVM running for 3.497)
[INFO] GCLOUD: 2019-12-28 20:00:01.050:WARN:oejw.WebAppContext:main: Failed startup of context c.g.a.t.d.j.DevAppEngineWebAppContext@7ce4de34{/,file:///home/ulises/demo/target/demo-0.0.1-SNAPSHOT/,UNAVAILABLE}{/home/ulises/demo/target/demo-0.0.1-SNAPSHOT}
[INFO] GCLOUD: java.lang.NoSuchMethodError: org.apache.tomcat.util.compat.JreCompat.isExported(Ljava/lang/Class;)Z
[INFO] GCLOUD:  at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:70)
[INFO] GCLOUD:  at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
[INFO] GCLOUD:  at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:64)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:347)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
[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:167)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[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:167)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.start(Server.java:418)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.doStart(Server.java:382)
[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:343)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:283)
[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:271)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:44)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:220)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:218)
[INFO] GCLOUD:  at java.security.AccessController.doPrivileged(Native Method)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:218)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:404)
[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:257)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)
[INFO] GCLOUD: 2019-12-28 20:00:01.052:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
[INFO] GCLOUD: 2019-12-28 20:00:01.052:INFO:oejs.session:main: node0 Scavenging disabled
[INFO] GCLOUD: 2019-12-28 20:00:01.058:INFO:oejs.AbstractConnector:main: Started NetworkTrafficSelectChannelConnector@2ac273d3{HTTP/1.1,[http/1.1]}{localhost:8080}
[INFO] GCLOUD: 2019-12-28 20:00:01.059:INFO:oejs.Server:main: Started @3525ms
[INFO] GCLOUD: Dec 28, 2019 7:00:01 PM com.google.appengine.tools.development.AbstractModule startup
[INFO] GCLOUD: INFO: Module instance default is running at http://localhost:8080/
[INFO] GCLOUD: Dec 28, 2019 7:00:01 PM com.google.appengine.tools.development.AbstractModule startup
[INFO] GCLOUD: INFO: The admin console is running at http://localhost:8080/_ah/admin
[INFO] GCLOUD: Dec 28, 2019 8:00:01 PM com.google.appengine.tools.development.DevAppServerImpl doStart
[INFO] GCLOUD: INFO: Dev App Server is now running

您可以看到日志中有一个错误,当我搜索它时也没有帮助我

[INFO] GCLOUD: java.lang.NoSuchMethodError: org.apache.tomcat.util.compat.JreCompat.isExported(Ljava/lang/Class;)Z
[INFO] GCLOUD:  at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:70)
[INFO] GCLOUD:  at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
[INFO] GCLOUD:  at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:64)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:347)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
[INFO] GCLOUD:  at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
[INFO] GCLOUD:  at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
[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:167)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[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:167)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.start(Server.java:418)
[INFO] GCLOUD:  at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
[INFO] GCLOUD:  at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
[INFO] GCLOUD:  at org.eclipse.jetty.server.Server.doStart(Server.java:382)
[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:343)
[INFO] GCLOUD:  at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:283)
[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:271)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.access$000(DevAppServerImpl.java:44)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:220)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl$1.run(DevAppServerImpl.java:218)
[INFO] GCLOUD:  at java.security.AccessController.doPrivileged(Native Method)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:218)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:404)
[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:257)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)

如果我通过mvn spring-boot:run使用Spring Boot maven插件执行应用程序,则该应用程序将完美运行。

如果我还使用Google Coud工具插件在Eclipse中创建了App Engine应用程序,则它生成的启动器应用程序也可以正常工作。因此,在我的代码或缺少的某些配置中一定有问题。

怎么回事?

谢谢!

1 个答案:

答案 0 :(得分:1)

好的,我发现了问题。删除Tomcat依赖项还不够:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

我还必须像这样从spring-boot-starter-web中排除它:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>