{"record":{"id":"b3394199af93634e","repo":"apache/dubbo","slug":"the-interface-class-interfaceclass-is-not-a-inte-b33941","errorCode":null,"errorMessage":"The interface class <interfaceClass> is not a interface!","messagePattern":"The interface class <interfaceClass> is not a interface!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java","lineNumber":323,"sourceCode":"    @Override\n    public void checkInterface() {\n        if (interfaceClass == null || interfaceClass.isInterface()) {\n            return;\n        }\n        List<ProtocolConfig> protocols = getProtocols();\n        if (CollectionUtils.isEmpty(protocols)) {\n            return;\n        }\n        for (ProtocolConfig protocol : protocols) {\n            String name = protocol.getName();\n            if (CommonConstants.TRIPLE.equals(name) && Boolean.TRUE.equals(protocol.isNoInterfaceSupport())) {\n                return;\n            }\n            if (Constants.REST_PROTOCOL.equals(name)) {\n                return;\n            }\n        }\n        throw new IllegalStateException(\"The interface class \" + interfaceClass + \" is not a interface!\");\n    }\n\n    @Transient\n    public T getRef() {\n        return ref;\n    }\n\n    public void setRef(T ref) {\n        this.ref = ref;\n    }\n\n    @Parameter(excluded = true)\n    public String getPath() {\n        return path;\n    }\n\n    public void setPath(String path) {\n        this.path = path;","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/ServiceConfigBase.java#L305-L341","documentation":"Thrown by ServiceConfigBase.checkInterface when the interfaceClass is not an interface AND none of the configured protocols permit a non-interface class. A non-interface class is only allowed for the Triple protocol (with noInterfaceSupport=true) or the REST protocol; otherwise Dubbo requires a true interface.","triggerScenarios":"checkInterface() runs (e.g. during setInterface or refresh) with a non-interface interfaceClass, protocols set, and every protocol is neither (Triple + noInterfaceSupport==true) nor REST.","commonSituations":"Exporting a concrete/abstract class as a service on the default dubbo protocol (which requires an interface). Setting noInterfaceSupport=false (default) on a Triple service that exposes a concrete class. Mixing a non-interface impl with a protocol that does not support it.","solutions":["Expose an actual Java interface as the service type instead of a concrete/abstract class.","If using Triple and you must expose a concrete class, set protocol.noInterfaceSupport=true.","Switch to the REST protocol if a non-interface service class is required."],"exampleFix":"// before\nProtocolConfig p = new ProtocolConfig(\"tri\");\np.setNoInterfaceSupport(false);\nserviceConfig.setInterface(FooServiceImpl.class); // concrete\n\n// after\np.setNoInterfaceSupport(true); // or expose FooService interface instead","handlingStrategy":"validation","validationCode":"// Before export, confirm either it is an interface or a permitted protocol\nClass<?> iface = serviceConfig.getInterfaceClass();\nboolean nonInterfaceAllowed = serviceConfig.getProtocols().stream().anyMatch(p ->\n    (CommonConstants.TRIPLE.equals(p.getName()) && Boolean.TRUE.equals(p.isNoInterfaceSupport()))\n    || Constants.REST_PROTOCOL.equals(p.getName()));\nif (iface != null && !iface.isInterface() && !nonInterfaceAllowed) {\n    throw new IllegalStateException(iface + \" is not an interface and no protocol permits non-interface classes\");\n}\nserviceConfig.export();","typeGuard":"static boolean protocolAllowsNonInterface(List<ProtocolConfig> protocols) {\n    return protocols.stream().anyMatch(p ->\n        (CommonConstants.TRIPLE.equals(p.getName()) && Boolean.TRUE.equals(p.isNoInterfaceSupport()))\n        || Constants.REST_PROTOCOL.equals(p.getName()));\n}","tryCatchPattern":"try {\n    serviceConfig.checkInterface();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"is not a interface\")) {\n        // switch interfaceClass to an interface, or enable tri noInterfaceSupport / REST\n    }\n    throw e;\n}","preventionTips":["Expose Java interfaces for dubbo-protocol services.","For Triple concrete-class services, explicitly set protocol.noInterfaceSupport=true.","Validate the interface/protocol combination at config-load time."],"tags":["service-config","interface","protocol","triple"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}