I have been trying to get webstart to dump to a heap dump when it runs out of memory.
I know the jmap/jconsole way of doing it, but what I really want to do is add the option to jnlp file and have tried the following options.
The Java Web Start software allows you to download and run Java applications from the web. The Java Web Start software: Provides an easy, one-click activation of applications. Guarantees that you are always running the latest version of the application.
According to Java 7 Release Notes, the -XX:+HeapDumpOnOutOfMemoryError option is now supported for a webstart application (RFE: 6664424).
It will definetly not work when you place this option to the jnlp file. There is a list of allowed options and the others will be ignored. You can check the list of available JVM options in the documentation.
Note that the idea is that end-user will run you application on his computer. What would you do with the heap dump on his comp? It might be anyone in the world running your app. It won't make much sense if you were allowed to do this with end users JVM through your JNLP file.
The only situation I can think about would be you have access to that computer and you can check the dump later. In that case (you as a end user request the dump) it is actually possible if you bypass the autorun of the jnlp file from the browser and run it yourself via the javaws
command. The steps I have taken and which lead to success were as follows (assume the jnlp file was testOOM.jnlp
and you are on windows):
javaws -verbose -J-XX:+HeapDumpOnOutOfMemoryError testOOM.jnlp
Using this the app will be launched in the very same way as from the browser. But notice the -J
option which allows you to supply JVM options to the JVM. This is ok because it is the ebd user client who requested the dump.
On OutOfMemoryError
the heap dump will be stored in the same directory where you run your javaws
command from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With