theonedev/onedev · error · org.apache.wicket.WicketRuntimeException
Method {method.getName()} of {method.getDeclaringClass()} ta
Error message
Method {method.getName()} of {method.getDeclaringClass()} targeted at {target} on component {component} threw an exception What it means
A listener-interface method invoked reflectively threw an InvocationTargetException whose target was not a ReplaceHandlerException, AuthorizationException or WicketRuntimeException, so Wicket wraps it in a WicketRuntimeException carrying the method, target and component. The original business exception is the cause chain root.
Source
Thrown at server-core/src/main/java/org/apache/wicket/RequestListenerInterface.java:281
// initialization is required for stateless pages
if (!page.isInitialized())
{
page.internalInitialize();
}
try
{
method.invoke(target);
}
catch (InvocationTargetException e)
{
if (e.getTargetException() instanceof ReplaceHandlerException ||
e.getTargetException() instanceof AuthorizationException ||
e.getTargetException() instanceof WicketRuntimeException)
{
throw (RuntimeException)e.getTargetException();
}
throw new WicketRuntimeException("Method " + method.getName() + " of " +
method.getDeclaringClass() + " targeted at " + target + " on component " +
component + " threw an exception", e);
}
catch (Exception e)
{
throw new WicketRuntimeException("Method " + method.getName() + " of " +
method.getDeclaringClass() + " targeted at " + target + " on component " +
component + " threw an exception", e);
}
}
/**
* Method to call to register this interface for use
*/
public void register()
{
// Register this listener interface
registerRequestListenerInterface(this);View on GitHub (pinned to d44925c47c)
Solutions
- Read the 'Caused by' of the WicketRuntimeException — the fix belongs to the wrapped original exception
- Add try/catch inside listener methods for expected business failures and convert to feedback messages via component.error(...)
- Wrap risky calls in a custom behavior/requestcycle listener for centralized error handling
- Check target/component fields in the message to locate the offending component path
Example fix
// before
button.onClick(target -> orderService.submit(order)); // raw exception escapes
// after
button.onClick(target -> {
try { orderService.submit(order); }
catch (ValidationException e) { form.error(e.getMessage()); target.add(form); }
}); Defensive patterns
Strategy: try-catch
Validate before calling
// validate inputs before invoking handler
if (model.getObject() == null) { form.error("Nothing selected"); return; } Try / catch
try {
listenerMethod.invoke(...);
} catch (WicketRuntimeException e) {
Throwable cause = e.getCause(); // the real business exception
log.error("Handler failed on component", cause);
} Prevention
- Always inspect getCause() of WicketRuntimeException
- Catch expected business exceptions inside listener methods and report via component.error()
- Register an AbstractRequestCycleListener for centralized handler error handling
When it happens
Trigger: Any exception thrown inside a component listener method (onClick, onSubmit, etc.) that isn't one of Wicket's flow-control exceptions — e.g. NPE in the handler, a RuntimeException from a service call, a database error.
Common situations: NPEs from null models inside onClick; service-layer exceptions surfacing during form/Ajax handling; database constraint violations in submit handlers.
Related errors
- An error occurred while detaching component:
- Page classes should extend from BasePage.
- Base resource mapper should be used
- Invalid date range, expecting "yyyy-MM-dd to yyyy-MM-dd"
- Path '${mountPath}' should be mounted to a svg sprite resour
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/d4812cac10d213c4.
Report an issue: GitHub.