{"record":{"id":"da7344dc1d7cd577","repo":"apache/dubbo","slug":"is-not-a-interface","errorCode":null,"errorMessage":"{} is not a interface.","messagePattern":"(.+?) is not a interface\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java","lineNumber":100,"sourceCode":"        if (proxy == null) {\n            synchronized (ics[0]) {\n                proxy = cache.get(key);\n                if (proxy == null) {\n                    // create Proxy class.\n                    proxy = new Proxy(buildProxyClass(cl, ics, domain));\n                    cache.put(key, proxy);\n                }\n            }\n        }\n        return proxy;\n    }\n\n    private static String buildInterfacesKey(ClassLoader cl, Class<?>[] ics) {\n        StringBuilder sb = new StringBuilder();\n        for (Class<?> ic : ics) {\n            String itf = ic.getName();\n            if (!ic.isInterface()) {\n                throw new RuntimeException(itf + \" is not a interface.\");\n            }\n\n            Class<?> tmp = null;\n            try {\n                tmp = Class.forName(itf, false, cl);\n            } catch (ClassNotFoundException ignore) {\n            }\n\n            if (tmp != ic) {\n                throw new IllegalArgumentException(ic + \" is not visible from class loader\");\n            }\n\n            sb.append(itf).append(';');\n        }\n        return sb.toString();\n    }\n\n    private static Class<?> buildProxyClass(ClassLoader cl, Class<?>[] ics, ProtectionDomain domain) {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java#L82-L118","documentation":"Thrown by Proxy.buildInterfacesKey when one of the classes passed to getProxy is not an interface. Dubbo proxies implement interfaces only (it generates an implementor, not a subclass), so a concrete/abstract class is rejected with RuntimeException naming the class.","triggerScenarios":"Proxy.getProxy(SomeClass.class, ...) where SomeClass is not declared as an interface.","commonSituations":"Passing an implementation class instead of its interface; a type that was refactored from interface to class; misconfigured SPI that hands a class to the proxy factory.","solutions":["Pass only interface types to getProxy.","If you must proxy a concrete class, use a different proxying library (CGLIB) - Dubbo's Proxy is interface-only.","Add a pre-check ic.isInterface() for each class before calling getProxy."],"exampleFix":"// before\nProxy.getProxy(MyServiceImpl.class); // class, not interface\n\n// after\nProxy.getProxy(MyService.class); // interface","handlingStrategy":"validation","validationCode":"for (Class<?> ic : ics) {\n    if (!ic.isInterface()) {\n        throw new IllegalArgumentException(ic.getName() + \" is not an interface\");\n    }\n}\nProxy.getProxy(ics);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass only interface types to Proxy.getProxy.","Add a compile-time-style unit test asserting each element is an interface.","Remember Dubbo proxies are interface-only; use CGLIB for concrete-class proxying."],"tags":["bytecode","proxy","interface","validation"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}