Questions tagged [attach-api]

The Attach API is a Sun Microsystems extension that provides a mechanism to attach to a JavaTM virtual machine. A tool written in the Java Language, uses this API to attach to a target virtual machine and load its tool agent into that virtual machine.

The Attach API is a Sun Microsystems extension that provides a mechanism to attach to a JavaTM virtual machine. A tool written in the Java Language, uses this API to attach to a target virtual machine and load its tool agent into that virtual machine.

10 questions
9
votes
3 answers

Error while using Attach Api

While using attach API in Eclipse error is thrown in console. In order to use attach API I went to installed JRE in eclipse and then using edit option included the tools.jar in the external jars option in current JRE. But it throws the following…
Sanyam Goel
  • 2,138
  • 22
  • 40
5
votes
1 answer

Connecting to the JMX Agent Programmatically in Java 9

I need to connect to JMX agent programmatically using Attach API (loading agent at runtime if necessary) as shown in example here. This worked fine in Java 8 but doesn't work in Java 9 since there is no management-agent.jar in the lib folder…
3
votes
0 answers

How to attach a a Java agent to an already running VM instance

I am trying to attach a Java agent to a running Java instance using the attach API. The problem I am getting is when I check a process id of an already running Java process in Windows Task Manager and hard code it into the program attaching the java…
Sanyam Goel
  • 2,138
  • 22
  • 40
2
votes
2 answers

Load a Java agent JAR located inside the loader

I have two separate projects in my IDE for the agent and for the loader that finds a target VM and loads the agent JAR. When the agent project is built, the resulting agent JAR artifact is copied into the loader's resources folder. When the loader…
user7401478
  • 1,372
  • 1
  • 8
  • 25
2
votes
1 answer

IncompatibleClassChangeError when instrumenting running SpringBoot application with Byte Buddy

I would like to introduce Byte Buddy to my company and I have prepared a demo for my colleagues. Since we use Spring a lot, I thought the best example would be instrumentation of SpringBoot application. I have decided to add logs to RestController…
1
vote
1 answer

Java - is bytebuddy agent capable of "Fully" redefine a class?

Is byte-buddy agent capable of overcoming Attach API restrictions e.g. "new method definition", "static variable changes" ? I can see that redefineClasses method is being called from Agent Builder, but not sure if this is also following the same…
ha9u63a7
  • 6,233
  • 16
  • 73
  • 108
1
vote
0 answers

Using attach api in java to connect to remote server

When I'm trying to use attach api I'm getting an error com.sun.tools.attach.AttachNotSupportedException: Invalid process identifier I'm connecting with VirtualMachine vmRemote = VirtualMachine.attach("rmi://@:1099"); My…
Victor Garbuz
  • 75
  • 1
  • 8
0
votes
1 answer

Load a java agent during runtime on OpenJDK?

I've found many answers pointing me to VirtualMachine#loadAgent, which would honestly be great, except I don't have a VirtualMachine class, anywhere. I've been quite confused about it as well, however I do not seem to have any of the Attach API. I…
Frontear
  • 1,150
  • 12
  • 25
0
votes
0 answers

Java WebStart java.lang.NullPointerException at java.awt.Window.getWindows

i'm currently attaching to a java webstart application (anything from here: https://docs.oracle.com/javase/tutorial/uiswing/examples/misc/index.html#security) using the Java Attach API. That works without problems, but now i want to iterate over all…
xuckz
  • 43
  • 4
0
votes
1 answer

Attach library DLL cannot be loaded by application

I am doing bytecode manipulation in java, but it is being done on an external, running JAR file. For this reason, I am using the attach API. My current problem is that the attach API cannot load a DLL I have in a separate folder. I have proviously…
JD9999
  • 394
  • 1
  • 7
  • 18