unable to attach PID to jvm agent

classic Classic list List threaded Threaded
8 messages Options
kahkean92 kahkean92
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

unable to attach PID to jvm agent

This post was updated on .
i had tried to attach valid PID to jvm agent by using different version of jdk..however, it does not work..the following is the error message shown in command line...can some one provide the solution? thanks in advanced

roland roland
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

It seems that you try to attach to a JVM which already has something other attached (maybe already another agent ?). There's not much I can help but you can try to attach the agent during startup of the other Java process with `-javaagent:jolokia.jar`, then the process should share the same native attach library.

See also http://stackoverflow.com/questions/1030792/dll-already-loaded-in-another-classloader
... roland
Keam92 Keam92
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

Sorry roland, what do you mean by attach to a JVM which already has something other attached?jvm-agent?and shoud i put any .jar file to the application which i need to monitor?sry,i really need it for my project
roland roland
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

You should check out, how the application you want attach to is started. This is typically a startup script or .bat file. Within this you will find finally a call to `java` with some options. One of the options is probably `-javaagent` which installs another agent (not jolokia). You can simply add `-javaagent:/path/to/jolokia.jar` as it is described in the reference manual to this line.

Then this should work. I don't think dynamically attaching (i.e. attaching to an already running Java process) will work in your case.
... roland
Keam92 Keam92
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

Thx for your prompt feedback.ya -javaagent can work smoothly.anyway i hope i able to attach the java process which is already running.do you have any idea for it?
roland roland
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

Please read the stackoverflow answer above carefully. No, there is no solution if some other agent already loaded the DLL except to switch this agent off in the startup script.
... roland
kean92 kean92
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

thanks for help roland
Aakarshit Aakarshit
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: unable to attach PID to jvm agent

In reply to this post by roland
Hi Roland,
We are unable to attach the JVM agent to pid of flink process with jmx enabled on it.
We are using java 1.8, java hotspot is enabled, and doing it with the same UID only.
Also there are no other agents attached to that process.
Yet we are not able to bind the JVM agent with that process.

Error:
Invocation Target class com.sun.tools.attach.VirtualMachine <command:start> : null
Invocation Target class com.sun.tools.attach.VirtualMachine <command:status> : null
Loading...