I am using java visualVM 1.4 to do JDBC profling for my application, i need to do the following: 1-Start profiling 2-Take snapshot 3-Clear profiling records go back to step 1 I need to perform the previous loop for around 10 times, i am using my local-machine to do the entire work. So i do the steps successfully for two times after that either ther visualVM freezes or the java process i am profiling freezes, and my only solution is to restart both process and do the work again. I tried to read logs for visualVM and noticed that i see the following exception:
java.io.IOException: Can not attach to current VM
at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.<init>(HotSpotVirtualMachine.java:75)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:58)
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.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:124)
Caused: java.io.IOException: Can not attach to current VM
at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:126)
I am using jdk 8_152 for both the JVM and the java process.