{"record":{"id":"01f2cd05683707ef","repo":"quarkusio/quarkus","slug":"unable-to-load-class-s-for-creating-permission","errorCode":null,"errorMessage":"Unable to load class '%s' for creating permission","messagePattern":"Unable to load class '(.+?)' for creating permission","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/security/runtime/src/main/java/io/quarkus/security/runtime/SecurityCheckRecorder.java","lineNumber":373,"sourceCode":"\n    public SecurityCheckStorage create(RuntimeValue<SecurityCheckStorageBuilder> builder) {\n        return builder.getValue().create();\n    }\n\n    public void resolveRolesAllowedConfigExpRoles() {\n        if (!configExpRolesAllowedChecks.isEmpty()) {\n            for (SupplierRolesAllowedCheck configExpRolesAllowedCheck : configExpRolesAllowedChecks) {\n                configExpRolesAllowedCheck.resolveAllowedRoles();\n            }\n            configExpRolesAllowedChecks.clear();\n        }\n    }\n\n    private Class<?> loadClass(String className) {\n        try {\n            return Thread.currentThread().getContextClassLoader().loadClass(className);\n        } catch (ClassNotFoundException e) {\n            throw new RuntimeException(\"Unable to load class '\" + className + \"' for creating permission\", e);\n        }\n    }\n\n    public void registerDefaultSecurityCheck(RuntimeValue<SecurityCheckStorageBuilder> builder, SecurityCheck securityCheck) {\n        builder.getValue().registerDefaultSecurityCheck(securityCheck);\n    }\n\n    public Supplier<SecurityConstrainer> createSecurityConstrainer(Supplier<Map<String, Object>> additionalEventPropsSupplier) {\n        return new Supplier<SecurityConstrainer>() {\n            @Override\n            public SecurityConstrainer get() {\n                var container = Arc.container();\n                var beanManager = container.beanManager();\n                var eventPropsSupplier = additionalEventPropsSupplier == null ? new Supplier<Map<String, Object>>() {\n                    @Override\n                    public Map<String, Object> get() {\n                        return Map.of();\n                    }","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/SecurityCheckRecorder.java#L355-L391","documentation":"SecurityCheckRecorder.loadClass() loads a permission class by name via the thread contextClassLoader at runtime. If the class is not found it wraps the ClassNotFoundException in a RuntimeException. This happens during recording/registration of permission-based security checks when a configured permission class name cannot be resolved.","triggerScenarios":"quarkus.security.permissions.<name>.class or a @PermissionsAllowed permission class name refers to a class missing from the runtime application classpath, or a typo in the fully-qualified name.","commonSituations":"Typo in fully-qualified class name in configuration; permission class lives in a module/dependency not included in the build; class renamed after a refactor or version upgrade; class only present in a test scope dependency.","solutions":["Fix the fully-qualified class name in config or annotation — verify spelling and package.","Add the dependency containing the Permission class to the runtime (non-test, non-optional) scope.","Rebuild the application after adding the dependency so the class is packaged.","If using Quarkus, ensure the class is not in a deployment-only module; runtime classes must be in a runtime artifact."],"exampleFix":"// before (application.properties)\nquarkus.security.permissions.perm1.class=com.acme.security.MyPermisson\n// after (typo fixed)\nquarkus.security.permissions.perm1.class=com.acme.security.MyPermission","handlingStrategy":"validation","validationCode":"try {\n    Class.forName(\"com.acme.security.MyPermission\", false,\n        Thread.currentThread().getContextClassLoader());\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\"Permission class missing from runtime classpath\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    securedService.invoke();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unable to load class\")) {\n        log.error(\"Check quarkus.security.permissions.* class names and dependencies\", e);\n    }\n}","preventionTips":["Use fully-qualified names copied from the class declaration, never hand-typed","Keep permission classes in runtime-scope dependencies","Grep application.properties for permission class names after refactors","Run a smoke test that touches each configured permission at startup"],"tags":["security","classpath","classnotfound","permission"],"backgroundTag":"classnotfound","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"}