{"record":{"id":"eeeb78eb3e4ccdea","repo":"quarkusio/quarkus","slug":"unable-load-class","errorCode":null,"errorMessage":"Unable load class '''","messagePattern":"Unable load class '''","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-links/runtime/src/main/java/io/quarkus/resteasy/reactive/links/RestLinksHandler.java","lineNumber":48,"sourceCode":"            response.getHeaders().add(\"Link\", link);\n        }\n    }\n\n    private Collection<Link> getLinks(Response response) {\n        RestLinksProvider provider = getRestLinksProvider();\n\n        if ((restLinkData.getRestLinkType() == RestLinkType.INSTANCE) && response.hasEntity()) {\n            return provider.getInstanceLinks(response.getEntity());\n        }\n        return provider.getTypeLinks(\n                restLinkData.getEntityType() != null ? entityTypeClass() : response.getEntity().getClass());\n    }\n\n    private Class<?> entityTypeClass() {\n        try {\n            return Thread.currentThread().getContextClassLoader().loadClass(restLinkData.getEntityType());\n        } catch (ClassNotFoundException e) {\n            throw new IllegalStateException(\"Unable load class '\" + restLinkData.getEntityType() + \"'\", e);\n        }\n    }\n\n    private RestLinksProvider getRestLinksProvider() {\n        return Arc.container().instance(RestLinksProvider.class).get();\n    }\n\n    public static class RestLinkData {\n\n        public RestLinkData(RestLinkType restLinkType, String entityType) {\n            this.restLinkType = restLinkType;\n            this.entityType = entityType;\n        }\n\n        public RestLinkData() {\n        }\n\n        private RestLinkType restLinkType;","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-links/runtime/src/main/java/io/quarkus/resteasy/reactive/links/RestLinksHandler.java#L30-L66","documentation":"At request time, RestLinksHandler.entityTypeClass loads the stored entity type name via the thread context class loader to serve link lookups. If the class cannot be loaded (ClassNotFoundException), it throws IllegalStateException 'Unable load class <name>'.","triggerScenarios":"Calling RestLinksProvider/RestLinks.getLinks where the recorded entity type name is not loadable at runtime — e.g. the class was in an unindexed jar at build (so no handler) or was removed/renamed between builds; stale build artifacts; TCCL not set to the app classloader in a custom threading context.","commonSituations":"Hot-reload/quirks after refactoring entity names; running serialized data referencing old class names; calling the links API from a thread with a wrong context classloader.","solutions":["Do a clean rebuild (./mvnw clean install) so recorded metadata matches current classes.","Verify the entity class name in the rest-links config/code still exists and is spelled correctly.","Ensure the call happens on a Quarkus-managed thread where the TCCL is the application classloader."],"exampleFix":"// before\nclass Order { ... } // renamed from Orders, old recorded data\n// after: clean rebuild and update references from Orders -> Order","handlingStrategy":"try-catch","validationCode":"try { Thread.currentThread().contextClassLoader.loadClass(entityTypeName) } catch (e: ClassNotFoundException) { /* stale build or renamed entity */ }","typeGuard":null,"tryCatchPattern":"try {\n  linksProvider.getLinks(entity)\n} catch (e: IllegalStateException) {\n  logger.error(\"rest-links entity class not loadable: ${e.message}\")\n  throw e\n}","preventionTips":["Clean-rebuild after renaming entities","Keep link generation and entity classes in sync","Call link APIs on Quarkus-managed threads"],"tags":["runtime","classloading","rest-links"],"backgroundTag":"class-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}