hs-web/hsweb-framework · error · UnsupportedOperationException
unsupported dialect :
Error message
unsupported dialect :
What it means
DialectProviders.lookup(dialect) resolves a database dialect provider by name (or fully-qualified class name). If the name is not in the registry and does not contain a dot (so it cannot be reflectively loaded as a DialectProvider class), it throws UnsupportedOperationException listing the currently supported dialects.
Solutions
- Use a supported dialect name from the message's 'all alive dialect' list.
- If using a custom dialect, pass its fully-qualified class name (must contain '.') so it is loaded reflectively and cached.
- Correct the spelling/case of the dialect in your configuration.
- Implement a custom DialectProvider class for your database, then reference it by FQCN.
Example fix
// before String dialect = "postgresql9"; // not registered, no '.' DialectProvider p = DialectProviders.lookup(dialect); // throws // after String dialect = "postgresql"; // supported name // or: "com.example.CustomDialectProvider" DialectProvider p = DialectProviders.lookup(dialect);
Defensive patterns
Strategy: try-catch
Validate before calling
// only call lookup for known dialect names or FQCNs
if (!dialect.contains(".") && !KNOWN_DIALECTS.contains(dialect)) {
throw new IllegalArgumentException("unsupported dialect: " + dialect);
} Try / catch
try {
DialectProvider p = DialectProviders.lookup(dialect);
} catch (UnsupportedOperationException e) {
log.error("bad dialect '{}'; supported: {}", dialect, e.getMessage());
throw new ConfigurationException("fix hsweb dialect setting", e);
} Prevention
- Copy the dialect name from the supported list printed in the exception.
- For custom dialects always use the fully-qualified class name (contains '.').
- Re-check dialect config when upgrading hsweb versions.
- Call lookup() early at startup so bad dialect settings fail at boot.
When it happens
Trigger: Calling DialectProviders.lookup(...) with a short dialect name that is not registered, or configuring hsweb crud with an unsupported/misspelled dialect string that lacks a package prefix.
Common situations: Typo in the dialect property (e.g. 'postgresql9' vs 'postgresql'); using a database hsweb ships no provider for; hsweb version change where dialect keys differ; passing a short name instead of the FQCN of a custom DialectProvider.
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
- 不支持的验证规则:
- 不支持的授权请求:
- parentId
- join class [" + clazz + "] not found!
- join alias [" + alias + "] not found!
AI-assisted analysis of hs-web/hsweb-framework@b2cfc85a57 (2026-09-13).
Data as JSON: /api/errors/69b3f46f387e0ae0.
Report an issue: GitHub.
Appendix: source
Thrown at hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/DialectProviders.java:32
for (DialectProvider dialectProvider : ServiceLoader.load(DialectProvider.class)) {
allSupportedDialect.put(dialectProvider.name(), dialectProvider);
}
}
public static List<DialectProvider> all(){
return new ArrayList<>(allSupportedDialect.values());
}
@SneakyThrows
public static DialectProvider lookup(String dialect) {
DialectProvider provider = allSupportedDialect.get(dialect);
if (provider == null) {
if (dialect.contains(".")) {
provider = (DialectProvider) Class.forName(dialect).getConstructor().newInstance();
allSupportedDialect.put(dialect, provider);
} else {
throw new UnsupportedOperationException("unsupported dialect : " + dialect + ",all alive dialect :" + allSupportedDialect.keySet());
}
}
return provider;
}
}
View on GitHub (pinned to b2cfc85a57)