theonedev/onedev · error · org.apache.wicket.WicketRuntimeException
org.apache.wicket.WicketRuntimeException
Error message
org.apache.wicket.WicketRuntimeException
What it means
AbstractClassResolver.getResources() wraps any exception from ClassLoader.getResources(name) (I/O or lookup failure while scanning classpath resources) in a WicketRuntimeException. It signals the classloader failed to enumerate resources for a given name, not that resources were absent (empty results are legal).
Source
Thrown at server-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java:147
Set<URL> resultSet = new TreeSet<>(new UrlExternalFormComparator());
try
{
// Try the classloader for the wicket jar/bundle
Enumeration<URL> resources = Application.class.getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the classloader for the user's application jar/bundle
resources = Application.get().getClass().getClassLoader().getResources(name);
loadResources(resources, resultSet);
// Try the context class loader
resources = getClassLoader().getResources(name);
loadResources(resources, resultSet);
}
catch (Exception e)
{
throw new WicketRuntimeException(e);
}
return resultSet.iterator();
}
/**
*
* @param resources
* @param loadedResources
*/
private void loadResources(Enumeration<URL> resources, Set<URL> loadedResources)
{
if (resources != null)
{
while (resources.hasMoreElements())
{
final URL url = resources.nextElement();
loadedResources.add(url);View on GitHub (pinned to d44925c47c)
Solutions
- Inspect the cause for the underlying IOException/classloader problem
- Clean and redeploy the application — stale or corrupted jars in WEB-INF/lib are common culprits
- Verify the thread context classloader is set correctly (Thread.currentThread().setContextClassLoader) in embedded/custom environments
- Restart the application server to clear closed classloaders after hot redeploy
Example fix
// before Thread.currentThread().setContextClassLoader(oldLoader); // wrong/closed loader // after Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
Defensive patterns
Strategy: try-catch
Try / catch
try {
resolver.getResources(name);
} catch (WicketRuntimeException e) {
log.error("Classpath resource scan failed", e.getCause());
// trigger redeploy/restart path
} Prevention
- Clean WEB-INF/lib of corrupted/duplicate jars
- Set the context classloader correctly in embedded environments
- Avoid relying on hot redeploy; restart to refresh classloaders
When it happens
Trigger: ClassLoader.getResources throws — e.g. the context classloader is broken/closed, an app-server redeploy closed the old loader, or an I/O error reading a jar/directory on the classpath during scanning.
Common situations: Hot redeploys in Tomcat/Jetty leaving stale classloaders; corrupted jars in WEB-INF/lib; OSGi or exotic classloader environments where getResources misbehaves; classpath scanning of initializer patterns (META-INF/*).
Related errors
- 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
- Unable to find svg sprite resource mounted at: ${mountPath}
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/e3e311580b95533f.
Report an issue: GitHub.