I encountered a very strange problem with TomEE 1.5.1 and VisualVM 1.7.0_09 on MAC OSX mountain lion.
After TomEE loaded some webapp.Use VisualVM connect local TomEE process take long time, and after connected the gc button is disabled and I can not take a heap dump. the VisualVM' log show some error.
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
at sun.tools.attach.BsdVirtualMachine.<init>(BsdVirtualMachine.java:90)
at sun.tools.attach.BsdAttachProvider.attachVirtualMachine(BsdAttachProvider.java:63)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
at com.sun.tools.visualvm.attach.AttachModelImpl.getVirtualMachine(AttachModelImpl.java:104)
Caused: java.io.IOException: Unable to open socket file: target process not responding or HotSpot VM not loaded
the .java_pid<pid>
file not created in tmp folder.
But if I use VisualVM to connect TomEE after start it and before any webapps loaded, The .java_pid<pid>
file will created, and VisualVM will connect to it immediately, and heap dump works.
Another workaround is modify catalina.sh to add tools.jar to the ClassPath and remove openejb javaagent, then connect after TomEE fully started works fine.
Can not reproduce on a ubuntu machine.