flowable/flowable-engine · critical · RuntimeException
Exception while initializing Database connection
Error message
Exception while initializing Database connection
What it means
DbUtil.determineDatabaseType wraps any SQLException raised while querying database metadata (getting the connection or its product name) into a RuntimeException with message 'Exception while initializing Database connection', preserving the cause.
Source
Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/DbUtil.java:116
if (resultSet.next()) {
version = resultSet.getString("version");
}
if (StringUtils.isNotEmpty(version) && version.toLowerCase().startsWith(PRODUCT_NAME_CRDB.toLowerCase())) {
databaseProductName = PRODUCT_NAME_CRDB;
logger.info("CockroachDB version '{}' detected", version);
}
}
}
databaseType = databaseTypeMappings.getProperty(databaseProductName);
if (databaseType == null) {
throw new FlowableException("couldn't deduct database type from database product name '" + databaseProductName + "'");
}
logger.debug("using database type: {}", databaseType);
} catch (SQLException e) {
throw new RuntimeException("Exception while initializing Database connection", e);
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
logger.error("Exception while closing the Database connection", e);
}
}
return databaseType;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Read the wrapped cause (e.getCause()) to see the actual SQLException
- Verify jdbc url, credentials, and that the database is reachable (try connecting with a CLI/client)
- Ensure the database container/service is started before the Flowable engine initializes
- Check network/DNS/firewall between the app and the database
Example fix
// before jdbcUrl=jdbc:postgresql://db-host:5432/flowable // after (verify host/port & db running) # psql -h db-host -p 5432 -U flowable -d flowable jdbcUrl=jdbc:postgresql://localhost:5432/flowable
Defensive patterns
Strategy: try-catch
Validate before calling
try (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {
// connectivity probe before engine init
} catch (SQLException e) {
logger.error("Database unreachable at startup: {}", e.getMessage());
} Try / catch
try {
engineConfig.buildEngine();
} catch (RuntimeException e) {
if ("Exception while initializing Database connection".equals(e.getMessage())) {
logger.error("DB init failed, root cause: {}", e.getCause(), e.getCause());
}
} Prevention
- Always inspect getCause() for the real SQLException
- Add readiness/health checks so the app starts only after the DB is up
- Validate jdbc url/credentials in a smoke test before engine boot
When it happens
Trigger: Engine startup when the JDBC connection cannot be established: wrong host/port, bad credentials, database down, network/firewall blocking, or driver failure during getConnection or metadata retrieval.
Common situations: Database not yet started in Docker-compose order; wrong jdbc username/password; DB behind firewall; DNS resolution failure at boot.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- Invalid dbSqlSession: no active connection found
- JDBC requires that the JdbcType must be specified for all nu
- Error setting null for parameter #${i} with JdbcType ${jdbcT
- Error setting non null for parameter #${i} with JdbcType ${j
- There are app definitions with key = '' and version = ''
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/ed848cb1a83d42e7.
Report an issue: GitHub.