Java Can';t让Spring Boot应用程序在Google云平台灵活的环境中工作
在Google云平台灵活的环境中部署Spring Boot应用程序时遇到问题 我运行以下命令来部署:Java Can';t让Spring Boot应用程序在Google云平台灵活的环境中工作,java,spring-boot,google-app-engine,google-cloud-platform,google-cloud-sql,Java,Spring Boot,Google App Engine,Google Cloud Platform,Google Cloud Sql,在Google云平台灵活的环境中部署Spring Boot应用程序时遇到问题 我运行以下命令来部署:mvn clean compile package-DskipTests appengine:deploy-p cloud gcp my pom.xml中的云gcp配置文件具有以下内容: 云gcp com.google.cloud.tools appengine maven插件 1.3.2 β3 这是我的app.yaml文件,位于src/main/appengine/app.yaml: run
mvn clean compile package-DskipTests appengine:deploy-p cloud gcp
my pom.xml中的云gcp
配置文件具有以下内容:
云gcp
com.google.cloud.tools
appengine maven插件
1.3.2
β3
这是我的app.yaml
文件,位于src/main/appengine/app.yaml
:
runtime: java
env: flex
runtime_config:
jdk: openjdk8
env_variables:
SPRING_PROFILES_ACTIVE: "gcp"
handlers:
- url: /.*
script: this field is required, but ignored
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 4
disk_size_gb: 10
这是我的应用程序gcp.properties
:
server.address=0.0.0.0
server.port=8080
# Datasource
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
spring.datasource.username=xxx
spring.datasource.password=xxx
spring.datasource.url=jdbc:postgresql://google/xxx?cloudSqlInstance=xxx:europe-west4:xxx&autoReconnect=true&user=xxx&password=xxx&socketFactory=com.google.cloud.sql.postgres.SocketFactory&useSSL=false
server.error.whitelabel.enabled=false
# Optimize start of application
spring.jmx.enabled=false
# Gcp configuration
spring.cloud.gcp.sql.enabled=false
spring.cloud.gcp.sql.database-name=xxx
spring.cloud.gcp.sql.instance-connection-name=xxx:europe-west4:xxx
spring.cloud.gcp.logging.enabled=true
编译成功,没有问题。当我想访问我的Spring Boot应用程序时,问题就出现了。我经常收到一个502错误。日志中没有任何东西能让我知道什么是错的:
A 2020-01-20T16:14:17Z . ____ _ __ _ _
A 2020-01-20T16:14:17Z /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
A 2020-01-20T16:14:17Z ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
A 2020-01-20T16:14:17Z \\/ ___)| |_)| | | | | || (_| | ) ) ) )
A 2020-01-20T16:14:17Z ' |____| .__|_| |_|_| |_\__, | / / / /
A 2020-01-20T16:14:17Z =========|_|==============|___/=/_/_/_/
A 2020-01-20T16:14:17Z :: Spring Boot :: (v2.1.5.RELEASE)
com.xxx.api.xxxApplication : Starting xxxApplication v0.0.1-SNAPSHOT on bc233766746a with PID 1 (/app.jar started by root in /)
com.xxx.api.xxxApplication : The following profiles are active: gcp
.s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
.s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 532ms. Found 17 repository interfaces.
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$2c4dbf14] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$c4fb874e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
trationDelegate$BeanPostProcessorChecker : Bean 'objectPostProcessor' of type [org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@6b00f608' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$e9d02a00] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.hateoas.config.HateoasConfiguration' of type [org.springframework.hateoas.config.HateoasConfiguration$$EnhancerBySpringCGLIB$$abce0c46] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
o.apache.catalina.core.StandardService : Starting service [Tomcat]
org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.19]
o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 11326 ms
com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
Connecting to Cloud SQL instance [xxx:europe-west4:xxx] via SSL socket.
First Cloud SQL connection, generating RSA key pair.
这是我在日志中的最后一行。据我所知,似乎没有什么东西坏了,也没有什么错误。它似乎正确地连接到了云SQL实例。我在这里迷路了。我已经尝试了很多方法,但不管怎样,我总是从Spring Boot收到502请求
有关信息,即使服务器未启动(这很奇怪…)时,/liveness\u check
和/readiness\u check
始终返回200
如果您需要有关我正在使用的配置的更多信息,请告诉我。
提前谢谢你 我们终于解决了问题。对于可能有相同问题的人: 问题是由我们的番石榴版本引起的。我们添加了18.0版本,这显然是有问题的。我们在pom.xml中添加了以下依赖项:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
番石榴
番石榴
28.2-jre
问题解决了:)我们终于解决了问题。对于可能有相同问题的人: 问题是由我们的番石榴版本引起的。我们添加了18.0版本,这显然是有问题的。我们在pom.xml中添加了以下依赖项:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
番石榴
番石榴
28.2-jre
问题解决了:)我们终于解决了问题。对于可能有相同问题的人: 问题是由我们的番石榴版本引起的。我们添加了18.0版本,这显然是有问题的。我们在pom.xml中添加了以下依赖项:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
</dependency>
番石榴
番石榴
28.2-jre
问题解决了:)我们终于解决了问题。对于那些可能有同样问题的人:问题是由我们的番石榴版本引起的。我们添加了18.0版本,这显然是有问题的。我们在pom.xml中添加了28.2-jre版本来解决这个问题,我们最终解决了这个问题。对于那些可能有同样问题的人:问题是由我们的番石榴版本引起的。我们添加了18.0版本,这显然是有问题的。我们在pom.xml中添加了28.2-jre版本来解决这个问题,我们最终解决了这个问题。对于那些可能有同样问题的人:问题是由我们的番石榴版本引起的。我们添加了18.0版本,这显然是有问题的。我们在pom.xml中添加了28.2-jre版本来解决这个问题。