apache/shenyu · error · ShenyuException
e.getMessage()
Error message
e.getMessage()
What it means
NacosDataChangedInit.dataIdNotExist checks whether a plugin's dataId already exists in Nacos by calling configService.getConfig. On NacosException, the original message is wrapped in a ShenyuException and rethrown, surfacing Nacos client errors during the initial data check.
Solutions
- Check Nacos server address/namespace/group configuration (nacos.server-addr, namespace) in application.yml.
- Verify Nacos is reachable: curl http://<nacos-host>:8848/nacos and check firewalls.
- Read the wrapped e.getMessage() and LOG output — it carries the underlying NacosException reason; fix that cause.
- If Nacos auth is enabled, supply username/password credentials for the config service.
Example fix
// before
try { ... } catch (NacosException e) {
throw new ShenyuException(e.getMessage());
}
// after — surface cause chain for diagnosis
catch (NacosException e) {
throw new ShenyuException("Nacos config check failed for dataId " + pluginDataId, e);
} Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check
if (!nacosReachable(serverAddr, timeoutMs)) { throw new IllegalStateException("Nacos unreachable at " + serverAddr); } Type guard
null
Try / catch
try { return dataIdNotExist(pluginName); } catch (ShenyuException e) { log.error("Nacos init check failed: {}", e.getMessage(), e); /* decide: abort startup or default to not-exist */ } Prevention
- Verify nacos server-addr/namespace/group before deploying admin.
- Health-check Nacos in readiness probes before admin accepts traffic.
- Enable Nacos client logging to capture errCode details.
- Supply credentials when Nacos auth is enabled.
When it happens
Trigger: Calling dataIdNotExist(pluginName) (during admin startup init) when the Nacos server is unreachable, credentials/namespace are wrong, or the Nacos SDK returns any NacosException (timeouts, connection refused, invalid group).
Common situations: Nacos server down or on a different host/port, wrong namespace configured, network/firewall blocking 8848, Nacos auth enabled but no credentials supplied, or group name mismatch.
Related errors
- e.getMessage()
- apollo client getItemValue time out
- sync.consul.url can not be null.
- sync.consul.url formatter is not incorrect.
- e.getMessage()
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/326b2c54f0f3b31c.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-admin-listener/shenyu-admin-listener-nacos/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java:67
this.configService = configService;
}
@Override
protected boolean notExist() {
return Stream.of(NacosPathConstants.PLUGIN_DATA_ID, NacosPathConstants.AUTH_DATA_ID, NacosPathConstants.META_DATA_ID, NacosPathConstants.PROXY_SELECTOR_DATA_ID)
.map(NodeDataPathUtils::appendListStuff)
.allMatch(this::dataIdNotExist);
}
private boolean dataIdNotExist(final String pluginDataId) {
try {
return Objects.isNull(
configService.getConfig(pluginDataId,
NacosPathConstants.GROUP,
NacosPathConstants.DEFAULT_TIME_OUT));
} catch (NacosException e) {
LOG.error("Get data from nacos error.", e);
throw new ShenyuException(e.getMessage());
}
}
}
View on GitHub (pinned to 567142e072)