{"record":{"id":"161bf7faf5901102","repo":"theonedev/onedev","slug":"resource-class-not-found-classname-161bf7","errorCode":null,"errorMessage":"Resource class not found: ${className}","messagePattern":"Resource class not found: (.+?)","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"warning","filePath":"server-core/src/main/java/io/onedev/server/web/page/help/ResourceDetailPage.java","lineNumber":38,"sourceCode":"import org.apache.wicket.request.mapper.parameter.PageParameters;\n\nimport edu.emory.mathcs.backport.java.util.Collections;\nimport io.onedev.server.exception.NotFoundException;\nimport io.onedev.server.web.component.link.ViewStateAwarePageLink;\n\npublic class ResourceDetailPage extends ApiHelpPage {\n\n\tprivate static final String PARAM_RESOURCE = \"resource\";\n\t\n\tprivate final Class<?> resourceClass;\n\t\n\tpublic ResourceDetailPage(PageParameters params) {\n\t\tsuper(params);\n\t\tvar className = params.get(PARAM_RESOURCE).toString();\n\t\ttry {\n\t\t\tresourceClass = Class.forName(className);\n\t\t} catch (ClassNotFoundException e) {\n\t\t\tthrow new NotFoundException(\"Resource class not found: \" + className);\n\t\t}\n\t}\n\n\t@Override\n\tprotected void onInitialize() {\n\t\tsuper.onInitialize();\n\t\t\n\t\tadd(new Label(\"title\", getResourceTitle(resourceClass)));\n\t\t\n\t\tString description = getResourceDescription(resourceClass);\n\t\tadd(new Label(\"description\", description).setEscapeModelStrings(false).setVisible(description!=null));\n\t\t\n\t\tadd(new ListView<Method>(\"methods\", new LoadableDetachableModel<List<Method>>() {\n\n\t\t\t@Override\n\t\t\tprotected List<Method> load() {\n\t\t\t\tList<Method> methods = new ArrayList<>();\n\t\t\t\t","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/help/ResourceDetailPage.java#L20-L56","documentation":"ResourceDetailPage resolves a resource class by name from the PARAM_RESOURCE page parameter using Class.forName. If no class with that name exists on the server classpath, a NotFoundException is thrown so Wicket renders a 404. This page only documents known resource classes, so arbitrary names fail.","triggerScenarios":"Visiting the resource help page with an unknown or misspelled 'resource' query parameter, or a URL from a different OneDev version referencing a class that was removed/renamed.","commonSituations":"Hand-typing a resource detail URL, stale bookmarks after an upgrade that renamed internal Wicket resources, or following an old doc link to a deleted class.","solutions":["Check the 'resource' query parameter and correct the class name (fully qualified, e.g. io.onedev.server.model.Project)","Browse the help index page to pick a valid resource link instead of constructing the URL manually","Upgrade/downgrade OneDev if the class exists in another version"],"exampleFix":"// before\nhttps://server/~help/resource/io.onedev.server.model.Isssue\n// after\nhttps://server/~help/resource/io.onedev.server.model.Issue","handlingStrategy":"validation","validationCode":"String className = params.get(\"resource\").toString();\ntry { Class.forName(className); } catch (ClassNotFoundException e) { /* render 404 or corrected link */ }","typeGuard":"boolean isValidResourceClass(String name) {\n    try { Class.forName(name); return true; } catch (ClassNotFoundException | LinkageError e) { return false; }\n}","tryCatchPattern":"try {\n    resourceClass = Class.forName(className);\n} catch (ClassNotFoundException e) {\n    throw new NotFoundException(\"Resource class not found: \" + className);\n}","preventionTips":["Link to resource help pages only from the generated help index, not hand-built URLs","Keep bookmarks updated after OneDev upgrades","Validate class names against the server's installed version"],"tags":["http-404","wicket","url-parameter","class-not-found"],"backgroundTag":"class-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}