Tagged articles
3 articles
Page 1 of 1
Architect
Architect
Dec 2, 2024 · Backend Development

Mastering Java Agents: Premain vs Attach for Bytecode Manipulation

This article explains how Java agents work, compares premain and attach agents, shows how to implement entry points, use Instrumentation and Javassist to transform bytecode, provides complete code samples, packaging instructions, and demonstrates the runtime output with diagrams.

AgentAttachInstrumentation
0 likes · 17 min read
Mastering Java Agents: Premain vs Attach for Bytecode Manipulation
Alibaba Cloud Native
Alibaba Cloud Native
Jan 16, 2023 · Cloud Native

Why Java Attach Fails on PID 1 in Containers and How to Fix It

The article reproduces the AttachNotSupportedException when Java runs as PID 1 in a container, explains the JVM attach workflow and LinuxThread model, and provides practical workarounds such as creating .attach_pid files, enabling StartAttachListener, or using newer JDK images.

ArthasAttachCloud Native
0 likes · 11 min read
Why Java Attach Fails on PID 1 in Containers and How to Fix It