diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java index 246694822a7..5d53f5b2a1a 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractConfig.java @@ -590,6 +590,15 @@ public String toString() { if (MethodUtils.isGetter(method)) { String name = method.getName(); String key = calculateAttributeFromGetter(name); + /** + * make sure attribute exists + */ + try { + getClass().getField(key); + } catch (NoSuchFieldException e) { + logger.warn(e.getMessage(), e); + continue; + } Object value = method.invoke(this); if (value != null) { buf.append(" ");