testcontainers/testcontainers-java · info · SQLFeatureNotSupportedException
getParentLogger not supported
Error message
getParentLogger not supported
What it means
The JDBC proxy driver's getParentLogger returns the delegate driver's parent logger when a real container-backed driver is active; otherwise it throws SQLFeatureNotSupportedException because the proxy itself has no underlying driver to delegate to. This mirrors the JDBC optional-API semantics.
Solutions
- Only call getParentLogger after establishing a jdbc:tc connection so the delegate driver exists
- Guard the call site for SQLFeatureNotSupportedException (an allowed outcome per JDBC spec)
- Get the parent logger from the underlying vendor driver directly if needed
Example fix
// before
Logger l = new ContainerDatabaseDriver().getParentLogger();
// after
Logger l;
try {
l = driver.getParentLogger();
} catch (SQLFeatureNotSupportedException e) {
l = null; // no delegate driver active
} Defensive patterns
Strategy: try-catch
Try / catch
Logger l;
try {
l = driver.getParentLogger();
} catch (java.sql.SQLFeatureNotSupportedException e) {
l = null; // no delegate active; acceptable per JDBC spec
} Prevention
- Establish a jdbc:tc connection before querying driver metadata
- Treat SQLFeatureNotSupportedException as expected for proxy drivers
- Skip getParentLogger in tooling that iterates all registered drivers
When it happens
Trigger: Calling Driver.getParentLogger() on a ContainerDatabaseDriver instance before any jdbc:tc connection was established (delegate == null), e.g. using the driver standalone rather than through a container connection.
Common situations: Driver-management/monitoring tools enumerating all registered drivers and calling getParentLogger on each; obtaining the driver via new ContainerDatabaseDriver() instead of via a jdbc:tc connection.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- The ClickHouse does not support this
- The Oracle Database driver does not support this
- Setting a in not supported in the versions below 22.1.0
- Database name not supported
- Could not load classpath init script
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/6f9bc675fa27617a.
Report an issue: GitHub.
Appendix: source
Thrown at modules/jdbc/src/main/java/org/testcontainers/jdbc/ContainerDatabaseDriver.java:288
return delegate != null ? delegate.getMajorVersion() : 1;
}
@Override
public int getMinorVersion() {
return delegate != null ? delegate.getMinorVersion() : 0;
}
@Override
public boolean jdbcCompliant() {
return delegate != null && delegate.jdbcCompliant();
}
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
if (delegate != null) {
return delegate.getParentLogger();
}
throw new SQLFeatureNotSupportedException("getParentLogger not supported");
}
/**
* Utility method to kill ALL database containers directly from test support code. It shouldn't be necessary to use this,
* but it is provided for convenience - e.g. for situations where many different database containers are being
* tested and cleanup is needed to limit resource usage.
*/
public static void killContainers() {
synchronized (jdbcUrlContainerCache) {
jdbcUrlContainerCache.values().forEach(JdbcDatabaseContainer::stop);
jdbcUrlContainerCache.clear();
containerConnections.clear();
initializedContainers.clear();
}
}
/**
* Utility method to kill a database container directly from test support code. It shouldn't be necessary to use this,View on GitHub (pinned to 8e549514e3)