部署Gitbub CI的问题:连接尝试失败

时间:2019-12-12 06:25:45

标签: java spring github continuous-integration devops

我正在尝试使用github CI部署我的应用程序。我的配置文件是应用程序默认设置,在尝试获取与数据库的连接时会生成错误。

我的工作流程是:

name: Java CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Setup PostgreSQL
      uses: Harmon758/postgresql-action@v1.0.0
    - name: Build with Maven
      run: mvn -B package --file pom.xml

在部署中生成错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.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 open JDBC Connection for DDL execution

1 个答案:

答案 0 :(得分:0)

检查数据库是否正在侦听您的连接字符串所引用的端口,可能要解决的问题是从正在执行Spring应用程序的任何地方卷曲容器/服务器/ etc上的postgresql端口,并相应地调整网络连接< / p>