jd-opensource/joyagent-jdgenie · error · CatalogException
Could not find any jdbc dialect factory that can handled
Error message
Could not find any jdbc dialect factory that can handled
What it means
After discovering JdbcCatalogFactory providers, JdbcCatalogLoader.load filters them by the requested DialectEnum. If at least one factory exists on the classpath but none matches the requested dialect, it throws CatalogException('Could not find any jdbc dialect factory that can handled'). The provider jar is present but does not support the requested dialect.
Solutions
- Add the provider jar for the requested dialect to the classpath.
- Check that the DialectEnum value passed in matches a dialect actually supported by a deployed factory.
- Upgrade/align library versions so enum values and factory jdbcDialect() declarations agree.
- Log the available dialects foundFactories when this error occurs for easier diagnosis.
Example fix
// before
if (matchingFactories.isEmpty()) {
throw new CatalogException("Could not find any jdbc dialect factory that can handled ");
}
// after
if (matchingFactories.isEmpty()) {
throw new CatalogException("No jdbc dialect factory for " + jdbcDialect
+ "; available: " + foundFactories.stream().map(f -> f.jdbcDialect().toString()).toList());
} Defensive patterns
Strategy: validation
Validate before calling
// verify the dialect is supported before load
Set<DialectEnum> supported = discoverSupportedDialects(); // inspect available factories
if (!supported.contains(requestedDialect)) {
throw new IllegalArgumentException("Dialect " + requestedDialect + " not deployed; supported: " + supported);
} Try / catch
try {
JdbcCatalog catalog = JdbcCatalogLoader.load(dialect);
} catch (CatalogException e) {
if (e.getMessage().contains("no jdbc dialect factory that can handled")) {
// fall back to a default dialect or fail config validation at startup
} else throw e;
} Prevention
- Validate configured dialect against supported set at startup.
- Ship the provider jar for every dialect the config may select.
- Keep DialectEnum and factory jdbcDialect() declarations version-aligned.
- Log available dialects in the error for diagnosis.
When it happens
Trigger: load(JdbcDialect.X) where the classpath contains dialect providers but none returns jdbcDialect()==X — e.g., requesting a dialect (Oracle, ClickHouse, ...) whose provider jar isn't included while other dialect jars are.
Common situations: Config selects a dialect not in the deployed dialect set; dialect enum renamed/moved between library versions so filter never matches; only the default dialect jar shipped with the app.
Related errors
- Failed listing database in catalog
- Failed getting table
- Could not find any jdbc dialect factories that implement
- Multiple jdbc dialect factories can handle
- Could not load service provider for Catalog factory.
AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08).
Data as JSON: /api/errors/3ef32eec22a32dd6.
Report an issue: GitHub.
Appendix: source
Thrown at genie-backend/src/main/java/com/jd/genie/data/jdbc/catalog/JdbcCatalogLoader.java:32
public final class JdbcCatalogLoader {
private JdbcCatalogLoader() {
}
public static JdbcCatalog load(DialectEnum jdbcDialect) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
List<JdbcCatalogFactory> foundFactories = discoverFactories(cl);
if (foundFactories.isEmpty()) {
throw new JdbcBizException(String.format(
"Could not find any jdbc dialect factories that implement '%s' in the classpath.",
JdbcCatalog.class.getName()));
}
final List<JdbcCatalogFactory> matchingFactories =
foundFactories.stream().filter(f -> f.jdbcDialect() == jdbcDialect).toList();
if (matchingFactories.isEmpty()) {
throw new CatalogException("Could not find any jdbc dialect factory that can handled ");
}
if (matchingFactories.size() > 1) {
throw new JdbcBizException("Multiple jdbc dialect factories can handle");
}
return matchingFactories.get(0).createCatalog();
}
private static List<JdbcCatalogFactory> discoverFactories(ClassLoader classLoader) {
try {
final List<JdbcCatalogFactory> result = new LinkedList<>();
ServiceLoader.load(JdbcCatalogFactory.class, classLoader)
.iterator()
.forEachRemaining(result::add);
return result;
} catch (ServiceConfigurationError e) {
log.error("Could not load service provider for Catalog factory.", e);View on GitHub (pinned to 2417e0b8b6)