{"record":{"id":"74606f524c7acf06","repo":"apache/dubbo","slug":"cause-message","errorCode":null,"errorMessage":"${cause.message}","messagePattern":"\\$\\{cause\\.message\\}","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java","lineNumber":179,"sourceCode":"            Map map = (Map) obj;\n            map.forEach((key, value) -> {\n                Object keyDescriptor = key == null ? null : createDescriptorIfAbsent(key, accessor, cache);\n                Object valueDescriptor = value == null ? null : createDescriptorIfAbsent(value, accessor, cache);\n                descriptor.setProperty(keyDescriptor, valueDescriptor);\n            }); // ~ end of loop map\n        } else {\n            if (JavaBeanAccessor.isAccessByMethod(accessor)) {\n                Map<String, Method> methods = ReflectUtils.getBeanPropertyReadMethods(obj.getClass());\n                for (Map.Entry<String, Method> entry : methods.entrySet()) {\n                    try {\n                        Object value = entry.getValue().invoke(obj);\n                        if (value == null) {\n                            continue;\n                        }\n                        JavaBeanDescriptor valueDescriptor = createDescriptorIfAbsent(value, accessor, cache);\n                        descriptor.setProperty(entry.getKey(), valueDescriptor);\n                    } catch (Exception e) {\n                        throw new RuntimeException(e.getMessage(), e);\n                    }\n                } // ~ end of loop method map\n            } // ~ end of if (JavaBeanAccessor.isAccessByMethod(accessor))\n\n            if (JavaBeanAccessor.isAccessByField(accessor)) {\n                Map<String, Field> fields = ReflectUtils.getBeanPropertyFields(obj.getClass());\n                for (Map.Entry<String, Field> entry : fields.entrySet()) {\n                    if (!descriptor.containsProperty(entry.getKey())) {\n                        try {\n                            Object value = entry.getValue().get(obj);\n                            if (value == null) {\n                                continue;\n                            }\n                            JavaBeanDescriptor valueDescriptor = createDescriptorIfAbsent(value, accessor, cache);\n                            descriptor.setProperty(entry.getKey(), valueDescriptor);\n                        } catch (Exception e) {\n                            throw new RuntimeException(e.getMessage(), e);\n                        }","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtil.java#L161-L197","documentation":"Thrown while serializing a plain bean by accessor METHOD. For each getter, Dubbo invokes it reflectively and recurses into createDescriptorIfAbsent; any exception (IllegalAccessException, InvocationTargetException from a getter that throws, or a recursion failure) is rewrapped as RuntimeException(cause.message, cause). The original cause is preserved as the exception's cause.","triggerScenarios":"JavaBeanSerializeUtil.serialize(obj, JavaBeanAccessor.METHOD) where a getter throws, is inaccessible, or returns a value whose own serialization fails.","commonSituations":"A getter performs side-effecting logic that throws (e.g. lazy init hitting a closed resource); a SecurityManager or module boundary blocks reflective access; a self-referential or deeply nested object triggers a downstream error; serializing with METHOD accessor only and a field has no public getter.","solutions":["Inspect getCause() of the RuntimeException to find the real offending getter (InvocationTargetException target is the user exception).","Fix or guard the getter so it does not throw during serialization.","If a property cannot be serialized, switch to JavaBeanAccessor.FIELD or mark the accessor to skip problematic properties.","Ensure the class and its getters are accessible from Dubbo's classloader/module path."],"exampleFix":"// before\npublic Expensive getThing() {\n    return service.load(); // throws when service is closed\n}\n\n// after\npublic Expensive getThing() {\n    return service != null && service.isOpen() ? service.load() : null;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    JavaBeanDescriptor d = JavaBeanSerializeUtil.serialize(obj, JavaBeanAccessor.METHOD);\n} catch (RuntimeException e) {\n    Throwable c = e.getCause(); // InvocationTargetException wraps the real getter fault\n    // inspect c to find the offending getter\n}","preventionTips":["Keep getters side-effect free so they never throw during serialization.","Ensure getter methods and their declaring class are reflectively accessible from Dubbo's loader.","Unit-test serialize(obj, JavaBeanAccessor.METHOD) on each domain type."],"tags":["beanutil","serialization","reflection"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}