{"record":{"id":"e3e311580b95533f","repo":"theonedev/onedev","slug":"org-apache-wicket-wicketruntimeexception","errorCode":null,"errorMessage":"org.apache.wicket.WicketRuntimeException","messagePattern":"org\\.apache\\.wicket\\.WicketRuntimeException","errorType":"exception","errorClass":"org.apache.wicket.WicketRuntimeException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java","lineNumber":147,"sourceCode":"\t\tSet<URL> resultSet = new TreeSet<>(new UrlExternalFormComparator());\n\n\t\ttry\n\t\t{\n\t\t\t// Try the classloader for the wicket jar/bundle\n\t\t\tEnumeration<URL> resources = Application.class.getClassLoader().getResources(name);\n\t\t\tloadResources(resources, resultSet);\n\n\t\t\t// Try the classloader for the user's application jar/bundle\n\t\t\tresources = Application.get().getClass().getClassLoader().getResources(name);\n\t\t\tloadResources(resources, resultSet);\n\n\t\t\t// Try the context class loader\n\t\t\tresources = getClassLoader().getResources(name);\n\t\t\tloadResources(resources, resultSet);\n\t\t}\n\t\tcatch (Exception e)\n\t\t{\n\t\t\tthrow new WicketRuntimeException(e);\n\t\t}\n\n\t\treturn resultSet.iterator();\n\t}\n\n\t/**\n\t * \n\t * @param resources\n\t * @param loadedResources\n\t */\n\tprivate void loadResources(Enumeration<URL> resources, Set<URL> loadedResources)\n\t{\n\t\tif (resources != null)\n\t\t{\n\t\t\twhile (resources.hasMoreElements())\n\t\t\t{\n\t\t\t\tfinal URL url = resources.nextElement();\n\t\t\t\tloadedResources.add(url);","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java#L129-L165","documentation":"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).","triggerScenarios":"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.","commonSituations":"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/*).","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"],"exampleFix":"// before\nThread.currentThread().setContextClassLoader(oldLoader); // wrong/closed loader\n// after\nThread.currentThread().setContextClassLoader(getClass().getClassLoader());","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    resolver.getResources(name);\n} catch (WicketRuntimeException e) {\n    log.error(\"Classpath resource scan failed\", e.getCause());\n    // trigger redeploy/restart path\n}","preventionTips":["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"],"tags":["wicket","classpath","classloader"],"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-14T05:17:10.506Z"}