Skip to content

Flyway Unable to Load PostgreSQL Driver in peppol-reporting-backend-sql #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lukasrosenke opened this issue Apr 14, 2025 · 0 comments

Comments

@lukasrosenke
Copy link

lukasrosenke commented Apr 14, 2025

Description

When using PostgreSQL as the reporting backend, Flyway fails to initialize with the error No database found to handle jdbc:postgresql://postgres:5432/reports. This occurs despite the PostgreSQL JDBC driver being properly added as a dependency and the application being able to connect to PostgreSQL when Flyway is disabled.

Steps to Reproduce

  1. Configure reporting to use PostgreSQL:

    peppol.reporting.jdbc.database-type=postgresql
    peppol.reporting.jdbc.driver=org.postgresql.Driver
    peppol.reporting.jdbc.url=jdbc:postgresql://postgres:5432/reports
    peppol.reporting.jdbc.user=user1
    peppol.reporting.jdbc.password=password1
    peppol.reporting.flyway.enabled=true
    peppol.reporting.flyway.jdbc.schema-create=true
  2. Add Reporting and PostgreSQL driver as a dependency:

    <dependency>
       <groupId>com.helger.peppol</groupId>
       <artifactId>peppol-reporting-backend-sql</artifactId>
       <version>${peppol-reporting.version}</version> <!-- 3.0.3 -->
     </dependency>
    
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.6.0</version>
    </dependency>
  3. Start the application and send test invoice to local AP

Error Message

INFO c.h.p.r.b.sql.FlywayMigrator$Singleton : Starting to run Flyway for DB type POSTGRESQL
Exception in thread "Thread-2" org.flywaydb.core.api.FlywayException: No database found to handle jdbc:postgresql://postgres:5432/reports

Investigation and Troubleshooting

  1. Verified PostgreSQL driver is in dependencies
  2. Confirmed database exists and is accessible with given credentials
  3. Successfully connected to database when bypassing Flyway
  4. When Flyway is disabled, application can connect but reports relation "peppol_reporting_item" does not exist

Workaround Found

Disabling Flyway (peppol.reporting.flyway.enabled=false) and manually creating the required tables allows the application to work properly, confirming that the issue is specific to Flyway driver loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant