首页 > 解决方案 > 将 Spring Boot 应用程序部署到 Google Cloud Platform 时出错

问题描述

[INFO] GCLOUD: 
[INFO] GCLOUD: Updating service [default] (this may take several minutes)...
[INFO] GCLOUD: ..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................failed.
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) Error Response: [9] 
[INFO] GCLOUD: Application startup error:
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) [spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD: Caused by: java.net.ConnectException: Connection refused (Connection refused)
[INFO] GCLOUD:  at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181]
[INFO] GCLOUD:  at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  ... 60 common frames omitted
[INFO] GCLOUD: 
[INFO] GCLOUD: 2019-03-07 22:03:26.369  WARN 1 --- [           main] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata : Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[INFO] GCLOUD: 2019-03-07 22:03:26.408  INFO 1 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
[INFO] GCLOUD: 2019-03-07 22:03:26.443  INFO 1 --- [           main] o.h.e.j.e.i.LobCreatorBuilderImpl        : HHH000422: Disabling contextual LOB creation as connection was null
[INFO] GCLOUD: 2019-03-07 22:03:26.447  INFO 1 --- [           main] org.hibernate.type.BasicTypeRegistry     : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@5dbe30be
[INFO] GCLOUD: 2019-03-07 22:03:32.331  INFO 1 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000228: Running hbm2ddl schema update
[INFO] GCLOUD: 2019-03-07 22:03:32.901 ERROR 1 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.
[INFO] GCLOUD: 
[INFO] GCLOUD: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[INFO] GCLOUD:  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:215) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.Driver.makeConnection(Driver.java:404) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.Driver.connect(Driver.java:272) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) [tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) [hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) [hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.ExtractionContextImpl.getJdbcConnection(ExtractionContextImpl.java:62) [hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:40) [hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:64) [hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) [spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) [spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) [spring-context-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) [spring-context-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) [spring-context-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at com.scrapbook.UserProfileMicroservice.UserProfileMicroserviceApplication.main(UserProfileMicroserviceApplication.java:10) [classes!/:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
[INFO] GCLOUD:  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
[INFO] GCLOUD:  at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD: Caused by: java.net.ConnectException: Connection refused (Connection refused)
[INFO] GCLOUD:  at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181]
[INFO] GCLOUD:  at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  ... 55 common frames omitted
[INFO] GCLOUD: 
[INFO] GCLOUD: 2019-03-07 22:03:32.937  WARN 1 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 08001
[INFO] GCLOUD: 2019-03-07 22:03:32.937 ERROR 1 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[INFO] GCLOUD: 2019-03-07 22:03:33.174  WARN 1 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to obtain JDBC Connection
[INFO] GCLOUD: 2019-03-07 22:03:33.282  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
[INFO] GCLOUD: 2019-03-07 22:03:34.587  INFO 1 --- [           main] utoConfigurationReportLoggingInitializer : 
[INFO] GCLOUD: 
[INFO] GCLOUD: Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
[INFO] GCLOUD: 2019-03-07 22:03:34.698 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application startup failed
[INFO] GCLOUD: 
[INFO] GCLOUD: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to obtain JDBC Connection
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1631) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) ~[spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.19.RELEASE.jar!/:1.5.19.RELEASE]
[INFO] GCLOUD:  at com.scrapbook.UserProfileMicroservice.UserProfileMicroserviceApplication.main(UserProfileMicroserviceApplication.java:10) [classes!/:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
[INFO] GCLOUD:  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
[INFO] GCLOUD:  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
[INFO] GCLOUD:  at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD:  at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [app.jar:0.0.1-SNAPSHOT]
[INFO] GCLOUD: Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to obtain JDBC Connection
[INFO] GCLOUD:  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:396) ~[spring-orm-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371) ~[spring-orm-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336) ~[spring-orm-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1689) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1627) ~[spring-beans-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  ... 24 common frames omitted
[INFO] GCLOUD: Caused by: org.hibernate.exception.JDBCConnectionException: Unable to obtain JDBC Connection
[INFO] GCLOUD:  at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.ExtractionContextImpl.getJdbcConnection(ExtractionContextImpl.java:65) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:40) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:64) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.<init>(DatabaseInformationImpl.java:60) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:123) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:101) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:472) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ~[hibernate-entitymanager-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360) ~[spring-orm-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384) ~[spring-orm-4.3.22.RELEASE.jar!/:4.3.22.RELEASE]
[INFO] GCLOUD:  ... 28 common frames omitted
[INFO] GCLOUD: Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[INFO] GCLOUD:  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:215) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.Driver.makeConnection(Driver.java:404) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.Driver.connect(Driver.java:272) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:736) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:668) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131) ~[tomcat-jdbc-8.5.37.jar!/:na]
[INFO] GCLOUD:  at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  at org.hibernate.tool.schema.extract.internal.ExtractionContextImpl.getJdbcConnection(ExtractionContextImpl.java:62) ~[hibernate-core-5.0.12.Final.jar!/:5.0.12.Final]
[INFO] GCLOUD:  ... 39 common frames omitted
[INFO] GCLOUD: Caused by: java.net.ConnectException: Connection refused (Connection refused)
[INFO] GCLOUD:  at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181]
[INFO] GCLOUD:  at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181]
[INFO] GCLOUD:  at org.postgresql.core.PGStream.<init>(PGStream.java:61) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144) ~[postgresql-9.4.1212.jre7.jar!/:9.4.1212.jre7]
[INFO] GCLOUD:  ... 55 common frames omitted
[INFO] GCLOUD: 
[INFO] GCLOUD: I0307 22:03:35.382071    26 jvmti_agent.cc:225] Java VM termination
[INFO] GCLOUD: I0307 22:03:36.510473    37 jvmti_agent_thread.cc:103] Agent thread exited: CloudDebugger_main_worker_thread
[INFO] GCLOUD: I0307 22:03:36.573439    26 worker.cc:116] Debugger threads terminated
[INFO] GCLOUD: I0307 22:03:36.580781    26 jvmti_agent.cc:239] JvmtiAgent::JvmtiOnVMDeath cleanup time: 1256907 microseconds
[INFO] GCLOUD: 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:29 min
[INFO] Finished at: 2019-03-08T03:33:51+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:deploy (default-cli) on project UserProfileMicroservice: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:deploy failed: Non zero exit: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

我在运行命令 ./mvnw -DskipTests appengine:deploy 时遇到错误,说它是 PluginExceutionException。

请帮我解决同样的问题。我添加了日志文件以提供一些清晰度。

我使用 app.yaml 来配置应用程序属性,并且我使用 IntelliJ IDEA 作为我的 IDE

标签: springdeploymentgoogle-cloud-platformcloudgcloud

解决方案


考虑检查您的数据库凭据(数据库连接 -> 端口号、用户、正确的架构...)和 Google Cloud 订阅(例如 API 密钥)。


推荐阅读