Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy to use performance and memory .NET profiler for Windows and Linux.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

How to configure Java location while attaching profiler

Moderators: Vladimir Kondratyev, Anton Katilin

How to configure Java location while attaching profiler

Postby vartikarai » Wed Jan 20, 2021 3:48 pm

I am trying to attach profiler to java application running on linux environment. But it is failing as it can not find the java file path. Is the java path hard coded anywhere ? Because it is not picking from JAVA_HOME environment variable. It is always trying to find the java under /usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java
vartikarai
 
Posts: 3
Joined: Wed Jan 20, 2021 3:37 pm

Re: How to configure Java location while attaching profiler

Postby Anton Katilin » Wed Jan 20, 2021 3:59 pm

Do you try to attach from the profiler UI or with the console wizard?

Is the target process local or remote?

Exactly what error do you get?
Anton Katilin
 
Posts: 6029
Joined: Wed Aug 11, 2004 8:37 am

Re: How to configure Java location while attaching profiler

Postby vartikarai » Thu Jan 21, 2021 9:02 am

I am trying to attach through command line on a linux environment bu running the attach.sh.

Attaching to process pid using default options
Exception in thread "main" com.yourkit.af.bg: Cannot execute command:
/usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java
-Dfile.encoding=UTF-8

ause: java.io.IOException: Cannot run program "/usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java": error=2, No such file or directory
at com.yourkit.af.bh.c(a:154)
at com.yourkit.attach.c.d(a:289)
at com.yourkit.attach.c.a(a:139)
at com.yourkit.attach.b.d(a:65)
at com.yourkit.Main.b(a:297)
at com.yourkit.Main.main(a:157)
Caused by: java.io.IOException: Cannot run program "/usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
at com.yourkit.af.bh.c(a:151)
... 5 more
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:340)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107

Also with jdk 11 I am getting another error.
I was able to attach to a running jvm earlier. But when I am trying now it is refusing with error

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/12525/root/tmp/.java_pid12525: target process 12525 doesn't respond within 10500ms or HotSpot VM not loaded
| at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:100)
| at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
| at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
| at com.yourkit.Attach.a(a:43)
| at com.yourkit.Attach.main(a:38)
vartikarai
 
Posts: 3
Joined: Wed Jan 20, 2021 3:37 pm

Re: How to configure Java location while attaching profiler

Postby Anton Katilin » Thu Jan 21, 2021 12:39 pm

Could you please send the full log file to [email protected]

What is the output for the following commands:

file /usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java
ls -l /usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java
/usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el7_9.x86_64/bin/java -version

> Also with jdk 11 I am getting another error.
Do you mean you attach to 2 different processes which gives different errors?
Anton Katilin
 
Posts: 6029
Joined: Wed Aug 11, 2004 8:37 am

Re: How to configure Java location while attaching profiler

Postby vartikarai » Thu Jan 21, 2021 1:28 pm

Since profiler was not working with JDK 8 so I installed JDK11 and tried to attach the profiler to same process but this time I am getting below error. Can you please tell me which version supports java 8?

com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file /proc/12525/root/tmp/.java_pid12525: target process 12525 doesn't respond within 10500ms or HotSpot VM not loaded
| at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:100)
| at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58)
| at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
| at com.yourkit.Attach.a(a:43)
| at com.yourkit.Attach.main(a:38)
vartikarai
 
Posts: 3
Joined: Wed Jan 20, 2021 3:37 pm

Re: How to configure Java location while attaching profiler

Postby Anton Katilin » Thu Jan 21, 2021 6:33 pm

Profiling of Java 8 is fully supported in the current profiler version. The console wizards should also run on Java 8.

We need to understand what you're doing. Could you please provide the full log as I requested.
Anton Katilin
 
Posts: 6029
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Google [Bot] and 1 guest

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.