How to Install and Use Arthas: Four Practical Deployment Options for Java Debugging

This guide explains how to set up Alibaba's open‑source Java diagnostic tool Arthas using four methods—running the jar locally, accessing the Web Console, adding it as a Maven dependency, and deploying via Docker—so developers can quickly troubleshoot bugs in production environments.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
How to Install and Use Arthas: Four Practical Deployment Options for Java Debugging

Arthas is an open‑source Java diagnostic tool from Alibaba that enables online troubleshooting of running applications. The article presents four practical ways to install and use Arthas, each suited to different deployment scenarios.

Option 1: Run the jar locally

The simplest approach is to download the Arthas boot jar from the official website and execute it directly. java -jar arthas-boot.jar [option] Running this command starts the Arthas client, allowing you to attach to a local Java process.

Option 2: Web Console

Instead of SSH’ing into each server, you can use Arthas's Web Console. First, download and start arthas-tunnel-server on a host (e.g., an ECS instance). Then launch the client with the server address as a parameter.

After the client connects, you can select a process to attach, obtain the agent‑id, and input it on the server’s web UI to control the target process remotely.

Option 3: Add as a project dependency

For Spring‑based projects, include the starter dependency:

<dependency>
    <groupId>com.taobao.arthas</groupId>
    <artifactId>arthas-spring-boot-starter</artifactId>
    <version>${arthas.version}</version>
</dependency>

For non‑Spring Boot projects, add the following dependencies:

<dependency>
    <groupId>com.taobao.arthas</groupId>
    <artifactId>arthas-agent-attach</artifactId>
    <version>${arthas.version}</version>
</dependency>
<dependency>
    <groupId>com.taobao.arthas</groupId>
    <artifactId>arthas-packaging</artifactId>
    <version>${arthas.version}</version>
</dependency>

After building, the application can be accessed at http://127.0.0.1:3658/, and you can optionally configure the Web Console with properties such as arthas.agent-id and arthas.tunnel-server=ws://server:7777/ws.

Option 4: Docker container

For containerized environments, embed Arthas in a Docker image. A typical Dockerfile looks like:

FROM openjdk:8-jdk-alpine
ADD target/*.jar app.jar
# copy arthas
COPY --from=hengyunabc/arthas:latest /opt/arthas /opt/arthas
RUN apk add --no-cache tini
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
MAINTAINER Montos [email protected]

After building the image, run the container, then use exec -it to enter and start Arthas just like in the local‑run method.

Conclusion

Among the four methods, the Web Console approach is often preferred because it avoids direct SSH access to each server, reduces operational overhead, and works well with both VM‑based services and Kubernetes pods. Choose the deployment that best matches your architecture to streamline Java debugging with Arthas.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockermavenArthasWeb ConsoleBackend ToolsJava debugging
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.