gpt4 book ai didi

java - 部署 Gitlab CI : The connection attempt failed 时出现问题

转载 作者:行者123 更新时间:2023-12-01 19:27:15 25 4
gpt4 key购买 nike

我正在尝试使用 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

最佳答案

检查数据库是否正在监听连接字符串引用的端口,可以解决问题的方法是从执行 Spring 应用程序的任何内容中 curl 容器/服务器/等上的 postgresql 端口并相应地调整网络

关于java - 部署 Gitlab CI : The connection attempt failed 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59298830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com