alibaba/arthas · critical · IllegalArgumentException
can not getResources arthas-bin.zip from classloader: ${clas
Error message
can not getResources arthas-bin.zip from classloader: ${classloader} What it means
Thrown by ArthasAgent.attach when arthasHome is not supplied and the current classloader cannot locate the bundled arthas-bin.zip resource. arthas-bin.zip is the packaged arthas distribution embedded in the arthas-agent-attach jar; if it is absent the agent cannot extract a working arthasHome.
Source
Thrown at arthas-agent-attach/src/main/java/com/taobao/arthas/agent/attach/ArthasAgent.java:102
} catch (Throwable e) {
// ignore
}
try {
if (instrumentation == null) {
instrumentation = ByteBuddyAgent.install();
}
// 检查 arthasHome
if (arthasHome == null || arthasHome.trim().isEmpty()) {
// 解压出 arthasHome
URL coreJarUrl = this.getClass().getClassLoader().getResource("arthas-bin.zip");
if (coreJarUrl != null) {
File tempArthasDir = createTempDir();
ZipUtil.unpack(coreJarUrl.openStream(), tempArthasDir);
arthasHome = tempArthasDir.getAbsolutePath();
} else {
throw new IllegalArgumentException("can not getResources arthas-bin.zip from classloader: "
+ this.getClass().getClassLoader());
}
}
// find arthas-core.jar
File arthasCoreJarFile = new File(arthasHome, ARTHAS_CORE_JAR);
if (!arthasCoreJarFile.exists()) {
throw new IllegalStateException("can not find arthas-core.jar under arthasHome: " + arthasHome);
}
AttachArthasClassloader arthasClassLoader = new AttachArthasClassloader(
new URL[] { arthasCoreJarFile.toURI().toURL() });
/**
* <pre>
* ArthasBootstrap bootstrap = ArthasBootstrap.getInstance(inst);
* </pre>
*/
Class<?> bootstrapClass = arthasClassLoader.loadClass(ARTHAS_BOOTSTRAP);View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Use the official, unmodified arthas-agent-attach jar that contains arthas-bin.zip.
- Pass an explicit arthasHome (a directory with arthas-core.jar) so the resource lookup is skipped.
- Fix the shade/assembly config to include arthas-bin.zip under resources.
Example fix
// before
ArthasAgent.attach(configWithoutArthasHome);
// -> can not getResources arthas-bin.zip from classloader
// after
// point config arthasHome to a full arthas install dir
config.put("arthasHome", "/opt/arthas");
ArthasAgent.attach(config); Defensive patterns
Strategy: validation
Validate before calling
java.net.URL zip = agentCL.getResource("arthas-bin.zip");
if (zip == null && (arthasHome == null || arthasHome.trim().isEmpty())) {
throw new IllegalStateException("arthas-bin.zip missing; supply arthasHome");
} Try / catch
try { agent.attach(config); }
catch (IllegalArgumentException e) { if (e.getMessage().contains("arthas-bin.zip")) { config.put("arthasHome", installDir); agent.attach(config); } else throw e; } Prevention
- Use the official unmodified arthas-agent-attach jar.
- Always supply arthasHome in embedded usage.
- Keep arthas-bin.zip in shade/assembly resources.
When it happens
Trigger: Using a repackaged/shaded arthas-agent-attach jar from which arthas-bin.zip was excluded; a custom/parent classloader that does not expose embedded resources; running the agent classes from an exploded layout that lost the zip.
Common situations: Maven shade/assembly plugin filtered out the zip; a dependency resolver stripped large binary resources; embedding only the .class files without the resource.
Related errors
- can not find arthas-core.jar under arthasHome: ${arthasHome}
- Arthas server port binding failed! Please check $HOME/logs/a
- Arthas server port binding failed! Please check $HOME/logs/a
- Failed to create directory within ${TEMP_DIR_ATTEMPTS} attem
- Invalid line number: {}
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/f64cd52f8bb882b0.
Report an issue: GitHub.