theonedev/onedev · warning · NotFoundException

Resource class not found

Error message

Resource class not found: ${className}

What it means

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.

Solutions

  1. Check the 'resource' query parameter and correct the class name (fully qualified, e.g. io.onedev.server.model.Project)
  2. Browse the help index page to pick a valid resource link instead of constructing the URL manually
  3. Upgrade/downgrade OneDev if the class exists in another version

Example fix

// before
https://server/~help/resource/io.onedev.server.model.Isssue
// after
https://server/~help/resource/io.onedev.server.model.Issue
Defensive patterns

Strategy: validation

Validate before calling

String className = params.get("resource").toString();
try { Class.forName(className); } catch (ClassNotFoundException e) { /* render 404 or corrected link */ }

Type guard

boolean isValidResourceClass(String name) {
    try { Class.forName(name); return true; } catch (ClassNotFoundException | LinkageError e) { return false; }
}

Try / catch

try {
    resourceClass = Class.forName(className);
} catch (ClassNotFoundException e) {
    throw new NotFoundException("Resource class not found: " + className);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/161bf7faf5901102. Report an issue: GitHub.

Appendix: source

Thrown at server-core/src/main/java/io/onedev/server/web/page/help/ResourceDetailPage.java:38

import org.apache.wicket.request.mapper.parameter.PageParameters;

import edu.emory.mathcs.backport.java.util.Collections;
import io.onedev.server.exception.NotFoundException;
import io.onedev.server.web.component.link.ViewStateAwarePageLink;

public class ResourceDetailPage extends ApiHelpPage {

	private static final String PARAM_RESOURCE = "resource";
	
	private final Class<?> resourceClass;
	
	public ResourceDetailPage(PageParameters params) {
		super(params);
		var className = params.get(PARAM_RESOURCE).toString();
		try {
			resourceClass = Class.forName(className);
		} catch (ClassNotFoundException e) {
			throw new NotFoundException("Resource class not found: " + className);
		}
	}

	@Override
	protected void onInitialize() {
		super.onInitialize();
		
		add(new Label("title", getResourceTitle(resourceClass)));
		
		String description = getResourceDescription(resourceClass);
		add(new Label("description", description).setEscapeModelStrings(false).setVisible(description!=null));
		
		add(new ListView<Method>("methods", new LoadableDetachableModel<List<Method>>() {

			@Override
			protected List<Method> load() {
				List<Method> methods = new ArrayList<>();
				

View on GitHub (pinned to d44925c47c)