{"record":{"id":"030b237a8520aaf5","repo":"apache/dubbo","slug":"t-getmessage","errorCode":null,"errorMessage":"<t.getMessage()>","messagePattern":"<t\\.getMessage\\(\\)>","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/ReferenceConfigBase.java","lineNumber":242,"sourceCode":"     * @param interfaceName\n     * @return\n     */\n    public static Class<?> determineInterfaceClass(String generic, String interfaceName) {\n        return determineInterfaceClass(generic, interfaceName, ClassUtils.getClassLoader());\n    }\n\n    public static Class<?> determineInterfaceClass(String generic, String interfaceName, ClassLoader classLoader) {\n        if (ProtocolUtils.isGeneric(generic)) {\n            return Dubbo2CompactUtils.isEnabled() && Dubbo2CompactUtils.isGenericServiceClassLoaded()\n                    ? Dubbo2CompactUtils.getGenericServiceClass()\n                    : GenericService.class;\n        }\n        try {\n            if (StringUtils.isNotEmpty(interfaceName)) {\n                return Class.forName(interfaceName, true, classLoader);\n            }\n        } catch (ClassNotFoundException t) {\n            throw new IllegalStateException(t.getMessage(), t);\n        }\n        return null;\n    }\n\n    @Override\n    protected void postProcessAfterScopeModelChanged(ScopeModel oldScopeModel, ScopeModel newScopeModel) {\n        super.postProcessAfterScopeModelChanged(oldScopeModel, newScopeModel);\n        if (this.consumer != null && this.consumer.getScopeModel() != getScopeModel()) {\n            this.consumer.setScopeModel(getScopeModel());\n        }\n    }\n\n    public void setInterface(Class<?> interfaceClass) {\n        if (interfaceClass != null && !interfaceClass.isInterface()) {\n            throw new IllegalStateException(\"The interface class \" + interfaceClass + \" is not a interface!\");\n        }\n        setInterface(interfaceClass == null ? null : interfaceClass.getName());\n        this.interfaceClass = interfaceClass;","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/ReferenceConfigBase.java#L224-L260","documentation":"Thrown by ReferenceConfigBase.determineInterfaceClass when the interface class name cannot be loaded by the given ClassLoader (ClassNotFoundException wrapped in IllegalStateException). This is the non-generic path: the interfaceName is non-empty but the class is absent from the classloader used to resolve it.","triggerScenarios":"Calling determineInterfaceClass(generic, interfaceName, classLoader) where interfaceName is set, generic is not a generic-serialization type, and Class.forName(interfaceName, true, classLoader) throws ClassNotFoundException.","commonSituations":"Interface class not on the consumer's classpath (missing dependency JAR). Wrong or stale interfaceName string. Custom ClassLoader that does not expose the interface class. Fat-jar/shading that relocated or omitted the interface. Multi-module build where the API module isn't a dependency of the consumer.","solutions":["Add the API module containing the interface to the consumer's dependencies.","Verify the interfaceName fully-qualified name matches the actual class exactly.","Ensure the ClassLoader passed in (or the TCCL) can see the interface class."],"exampleFix":"// before\n// consumer module is missing the api.jar that declares com.example.FooService\nReferenceConfig<FooService> ref = new ReferenceConfig<>();\nref.setInterface(\"com.example.FooService\");\n\n// after\n// add the api module dependency, then:\nref.setInterface(FooService.class);","handlingStrategy":"validation","validationCode":"// Verify the interface is loadable before constructing the reference\nClass<?> iface;\ntry {\n    iface = Class.forName(interfaceName, true, classLoader);\n} catch (ClassNotFoundException ex) {\n    throw new IllegalStateException(\"Interface not on classpath: \" + interfaceName\n        + \" — add the API dependency\", ex);\n}\nClass<?> determined = ReferenceConfigBase.determineInterfaceClass(generic, interfaceName, classLoader);","typeGuard":null,"tryCatchPattern":"try {\n    Class<?> c = ReferenceConfigBase.determineInterfaceClass(generic, interfaceName, loader);\n} catch (IllegalStateException e) {\n    Throwable root = e.getCause() != null ? e.getCause() : e;\n    // root is ClassNotFoundException; surface a clear 'missing dependency' message\n    throw new RuntimeException(\"Missing interface class \" + interfaceName\n        + \": ensure the API JAR is on the classpath\", root);\n}","preventionTips":["Add the interface API module as a dependency to consumer modules.","Validate classpath completeness in CI before integration tests.","Pass an already-loaded Class via setInterface(Class) when available."],"tags":["classpath","reference-config","classloader"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}