Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on IBM Java: ATTACH_ERR AgentInitializationException102 #18

Open
candrews opened this issue Apr 23, 2014 · 3 comments
Open

Comments

@candrews
Copy link

I'm trying to attach to a running process; this works great on the Sun/Oracle/Open JDK, but I can't get it to work on the IBM JDK.

root@ibmserver:/apps/IBM/WebSphere/AppServer/java/bin>java -jar /root/file-leak-detector-1.7-jar-with-dependencies.jar 5177488 http=19999
Connecting to 5177488
Activating file leak detector at /home/achinich/file-leak-detector-1.7-jar-with-dependencies.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.kohsuke.file_leak_detector.Main.run(Main.java:56)
        at org.kohsuke.file_leak_detector.Main.main(Main.java:35)
Caused by: com.sun.tools.attach.AgentInitializationException: ATTACH_ERR AgentInitializationException102
        at ibm.tools.attach.J9VirtualMachine.loadAgent(J9VirtualMachine.java:66)
        ... 6 more
@candrews candrews changed the title Doesn't work on IBM Java: com.sun.tools.attach.AttachNotSupportedException: target not found Doesn't work on IBM Java: ATTACH_ERR AgentInitializationException102 Apr 23, 2014
@e2bady
Copy link

e2bady commented Apr 27, 2014

I don't think it's an IBM JDK problem. I'm running OpenJDK Runtime Environment (IcedTea 2.4.4) and I have the same problem:

root@workstation:/home/bady# java -jar file-leak-detector-1.7-jar-with-dependencies.jar 3734 http=19999
Connecting to 3734
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.kohsuke.file_leak_detector.Main.run(Main.java:50)
    at org.kohsuke.file_leak_detector.Main.main(Main.java:35)
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
    at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:106)
    at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
    at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
    ... 6 more

Here is the hole Console output:

root@workstation:/home/bady# ps aux | grep java
tomcat7   3734  5.4 52.8 2790824 817408 ?      Sl   13:41   2:24 /usr/lib/jvm/java-7-openjdk-i386/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -server -Xmx2048m -Xms1024m -Xmn512m -XX:-OmitStackTraceInFastThrow -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
root      4989  0.0  0.0   4412   808 pts/1    S+   14:25   0:00 grep --color=auto java
root@workstation:/home/bady# java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.10.2)
OpenJDK Client VM (build 24.45-b08, mixed mode, sharing)
root@workstation:/home/bady# java -jar file-leak-detector-1.7-jar-with-dependencies.jar 3734 http=19999
Connecting to 3734
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.kohsuke.file_leak_detector.Main.run(Main.java:50)
    at org.kohsuke.file_leak_detector.Main.main(Main.java:35)
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
    at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:106)
    at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
    at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
    ... 6 more
root@workstation:/home/bady# 

@christ66
Copy link
Member

I believe in order for you to attach to the JVM you would need to run the command as the same user that's running the java process. You are running the command as root, but the process is ran by user tomcat7, so this would error. You can get this error also if you perform a jstack command as a different user from the one running the jvm. The only way around it would be to run jstack -F which will force attaching to the jvm process.

@zrlw
Copy link

zrlw commented Oct 1, 2019

Java Virtual Machine of the WebSphere Application Server should set to debug mode.
file-leak-detector for WebSphere Application Server 8.5 (IBM JDK 1.6)
https://github.com/zrlw/file-leak-detector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants