{"record":{"id":"fbd646fb44f74e46","repo":"apache/dubbo","slug":"cause-message-fbd646","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/bytecode/ClassGenerator.java","lineNumber":370,"sourceCode":"                        String[] sn = mCtc.getSimpleName().split(\"\\\\$+\"); // inner class name include $.\n                        mCtc.addConstructor(\n                                CtNewConstructor.make(code.replaceFirst(SIMPLE_NAME_TAG, sn[sn.length - 1]), mCtc));\n                    }\n                }\n            }\n\n            try {\n                return mPool.toClass(mCtc, neighborClass, loader, pd);\n            } catch (Throwable t) {\n                if (!(t instanceof CannotCompileException)) {\n                    return mPool.toClass(mCtc, loader, pd);\n                }\n                throw t;\n            }\n        } catch (RuntimeException e) {\n            throw e;\n        } catch (NotFoundException | CannotCompileException e) {\n            throw new RuntimeException(e.getMessage(), e);\n        }\n    }\n\n    public void release() {\n        if (mCtc != null) {\n            mCtc.detach();\n        }\n        if (mInterfaces != null) {\n            mInterfaces.clear();\n        }\n        if (mFields != null) {\n            mFields.clear();\n        }\n        if (mMethods != null) {\n            mMethods.clear();\n        }\n        if (mConstructors != null) {\n            mConstructors.clear();","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/ClassGenerator.java#L352-L388","documentation":"Thrown by ClassGenerator.toClass() when javassist cannot turn the generated bytecode into a Class. NotFoundException means a referenced class/method/field could not be found during compilation; CannotCompileException means the generated method bodies violated JVM or javassist constraints. Both are rewrapped as RuntimeException(cause.message, cause).","triggerScenarios":"Calling ccp.toClass(...) on a ClassGenerator whose added methods/fields reference classes missing from the pool, or whose generated source text is malformed (bad descriptors, duplicate methods, illegal bytecode).","commonSituations":"Dubbo Proxy/Mixin generation against interfaces whose referenced types are not visible to the generating ClassLoader; a method signature using a class not on the classpath; conflicting method overloads producing duplicate bytecode; very large generated classes hitting JVM limits.","solutions":["Inspect getCause(): NotFoundException => add the missing class jar to the classpath; CannotCompileException => fix the generated method descriptor.","Ensure every interface and its parameter/return types are loadable by the classloader passed to getProxy/mixin.","Reduce the interface surface or split proxies so each references resolvable types.","Reproduce with Proxy.getProxy(YourInterface.class) in a unit test to isolate the failing interface."],"exampleFix":"// before\nProxy p = Proxy.getProxy(MissingDepsInterface.class); // references absent types\n\n// after\n// add the jar providing MissingDepsInterface's parameter types, then:\nProxy p = Proxy.getProxy(MissingDepsInterface.class);","handlingStrategy":"try-catch","validationCode":"for (Class<?> ic : ics) {\n    for (Method m : ic.getMethods()) {\n        for (Class<?> pt : m.getParameterTypes()) {\n            Class.forName(pt.getName(), false, loader); // throws if a referenced type is missing\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Proxy.getProxy(ics);\n} catch (RuntimeException e) {\n    Throwable c = e.getCause();\n    if (c instanceof javassist.NotFoundException) { /* missing class */ }\n    else if (c instanceof javassist.CannotCompileException) { /* bad bytecode */ }\n}","preventionTips":["Ensure every interface and its parameter/return types are loadable by the ClassLoader passed to the proxy.","Reproduce Proxy.getProxy(Iface.class) in a unit test to isolate the failing interface.","Keep javassist on the classpath at the version bundled with your Dubbo release."],"tags":["bytecode","proxy","javassist","classpath"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}