apache/shenyu · error · ShenyuException
e.getMessage()
Error message
e.getMessage()
What it means
PolarisDataChangedListener.getConfig fetches a config file by dataId from Polaris; any PolarisException (cluster unreachable, auth error, invalid namespace/group) is wrapped in ShenyuException with only e.getMessage(). The caller loses the stack trace of the underlying failure. A missing file is NOT an error here — it returns null; only genuine Polaris API failures throw.
Solutions
- Confirm polaris address/namespace/file-group configuration in shenyu-admin yml matches the actual Polaris setup
- Verify the Polaris cluster is reachable from the admin process (network, DNS, port)
- Check the LOG.error line 'Polaris Get data from polaris error.' for the underlying root cause
- Restart/retry once the Polaris cluster is healthy — config sync retries depend on this call succeeding
Example fix
// before
} catch (PolarisException e) {
LOG.error("Polaris Get data from polaris error.", e);
throw new ShenyuException(e.getMessage());
}
// after
} catch (PolarisException e) {
LOG.error("Polaris Get data from polaris error.", e);
throw new ShenyuException("Polaris get config failed for dataId: " + e.getMessage(), e);
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check config presence without throwing
boolean ok;
try {
ok = configFileService.getConfigFile(ns, group, dataId) != null;
} catch (Exception e) { ok = false; }
if (!ok) { /* skip or reconnect */ } Try / catch
try {
String cfg = listener.getConfig(dataId);
} catch (ShenyuException e) {
LOG.warn("Polaris getConfig failed: {}", e.getMessage(), e);
// treat as transient: retry later or use cached value
} Prevention
- Pre-validate polaris connection settings at startup
- Distinguish 'missing file returns null' from 'API throws' in caller logic
- Add retries with backoff for transient Polaris outages
When it happens
Trigger: Calling getConfig(dataId) on the PolarisDataChangedListener when the Polaris API throws: server down, bad namespace/fileGroup, auth/token failure, or network timeout.
Common situations: Admin started before Polaris is available; wrong polaris namespace/file-group in yml; expired Polaris auth token; DNS resolution failure inside k8s.
Related errors
- e.getMessage()
- shenyu.jwt.secretKey is not configured. In a multi-instance…
- shenyu discovery mode current didn't support
- websocket on client open failed, namespaceId is null
- websocket sync token is not configured
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/c94e5401bf94e645.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin-listener/shenyu-admin-listener-polaris/src/main/java/org/apache/shenyu/admin/listener/polaris/PolarisDataChangedListener.java:88
configFilePublishService.releaseConfigFile(metadata);
} catch (PolarisException e) {
LOG.error("Polaris Publish data to polaris error.", e);
}
}
@Override
public void doDelConfig(final String dataId) {
doPublishConfig(dataId, null);
}
@Override
public String getConfig(final String dataId) {
try {
ConfigFile configFile = configFileService.getConfigFile(polarisProperties.getNamespace(), polarisProperties.getFileGroup(), dataId);
return configFile.hasContent() ? configFile.getContent() : null;
} catch (PolarisException e) {
LOG.error("Polaris Get data from polaris error.", e);
throw new ShenyuException(e.getMessage());
}
}
private boolean isReleased(final DefaultConfigFileMetadata metadata) {
try {
return Objects.nonNull(configFileService.getConfigFile(metadata).getContent());
} catch (PolarisException e) {
LOG.error("Polaris Get data from polaris error.", e);
throw new ShenyuException(e.getMessage());
}
}
}
View on GitHub (pinned to 567142e072)