I have a webservice on amazon ec2 running on glassfish 4 server, I tried to connect visualvm to the server but it were impossible, so I followed this tutorial (http://looksok.wordpress.com/2012/02/10/remote-use-of-visualvm-with-xming/), I installed the plugin glassfish in the server jvisualvm, and now I can monitor glassfish, but i cant do a heap dump to see my application use of memory detailled. How can I do?
Asked
Active
Viewed 1,641 times
0

John Saunders
- 160,644
- 26
- 247
- 397

RoberV
- 587
- 5
- 22
-
Did you try right-clicking the application in the Applications window and selecting Heap Dump? – Amir Afghani Dec 01 '14 at 17:52
-
I edit my question and post a screenshot. I try right-clicking glassfish on the left menu, and selecting heap dump, but it show me the error that you can see on the screen-shot. – RoberV Dec 02 '14 at 17:54
-
you might not have privileges to take the heap dump. Are you running the process as a privileged user? – Amir Afghani Dec 02 '14 at 19:38
-
Yes I run it as sudo – RoberV Dec 05 '14 at 17:44
-
Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders Jan 13 '15 at 13:12
1 Answers
1
You can use the jmap
tool in the JDK to create an HPROF format heapdump:
http://docs.oracle.com/javase/6/docs/technotes/tools/share/jmap.html
As an example, with the PID of your GlassFish in the screenshot above, the command would be as follows:
jmap -dump:file=/path/to/my/dumpfile.hprof 1376
You could also use jps
to find the process ID:
jps -v
The -v
flag makes the output verbose, giving you more information to tell which process is the right one.

Mike
- 4,852
- 1
- 29
- 48