-1

I have a problem and my job depend on of that.

There are some java apps with tomcat under Linux that crash ramdonly (the apps are not mine and it can not be modified). Every day we find in the morning some app broken. I want to see the java stack just when it crashed the app for seeing the message of the JVM (outofmemory, nullpointer etc). For if i can see an advice for fixing the problem.

I do not know nothing about to do this.

I saw searching in internet visualvm and jconsole for this. Is enough for what i want to do?. I want to see the messages of the java stack of JVM just when crashes.

I need help. Thank you very much.

  • You could also attach a demo version of yourkit and see what it finds. Plus enable any dump that is available, for example create a heapdump on oome (google that).Your Tomcat log should contain valuable info too. – Marged Dec 01 '17 at 17:06
  • And it is not possible to see the jvm stack with jconsole and visualvm as i want to use? – user3765208 Dec 02 '17 at 18:02
  • Exactly i would like to know: Can i set visualVM for when it detects a JVM crash it does a dump and show me the error of the JVM (if it is outmemoryerror or other message from the JVM)??? If it is possibly, how can i do that?. – user3765208 Dec 04 '17 at 13:05

1 Answers1

1

looks like you have memory leak issue, does the app works after restart for a particular period of time? You might want to see what happening inside java heap , for that you can take heap dump.. Use jcmd utility for this , you can find this utility within JDK installed on your server.

jcmd <process id/main class> GC.heap_dump filename=filename

NOTE: This will do a GC every time this runs.

To schedule this you need to set the cronjob.

Alternatively if you specify -XX:+HeapDumpOnOutOfMemoryError command-line option while running your application, then when an OutOfMemoryError exception is thrown, the JVM will generate a heap dump(in the logs).

Hope this helps. :)

Mr Kashyap
  • 562
  • 1
  • 5
  • 16
  • Thanks. And... how i put the command XX:+HeapDumpOnOutOfMemoryError?. Isbit a directive for Jvm?. In what file i add that?. And when the error occurs where is the dump file (path)?. That dump i read that i can read it with visualvm. – user3765208 Dec 03 '17 at 19:04