问题描述
我们在生产环境中安装了JRE,但没有安装JDK。 JRE和OS的版本如下。
We have a JRE installed on our production environment, but not a JDK. The versions of the JRE and OS are below.
[me@mymachine ~]$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
[me@mymachine ~]$ uname -a
Linux mymachine.mydomain.com 3.10.35-43.137.amzn1.x86_64 #1 SMP Wed Apr 2 09:36:59 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
似乎jmap工具不存在于系统的任何地方,并且没有root访问权限,我无法将其安装在任何系统位置。我该怎么做才能获得堆转储(即生成.hprof文件)?
It doesn’t appear as if the "jmap" tool is present anywhere on the system, and without root access, I’m not in a position to install it in any system location. What can I do to get a heap dump (i.e. produce a .hprof file)?
另外,如果重要的话,我们正在使用JBoss 7.1.3.AS。 / p>
Also, we're using JBoss 7.1.3.AS if that matters.
推荐答案
内置工具,如 jmap
, jconsole
和 jvisualvm
仅在JDK中可用。另一种选择是添加VM参数 -XX:+ HeapDumpOnOutOfMemoryError
,它告诉JVM在发生OutOfMemoryError时自动生成堆转储,并且参数 -XX:HeapDumpPath
指定堆转储的路径。
Built-in tools like jmap
, jconsole
, and jvisualvm
are only available in a JDK. Another option is to add the VM argument -XX:+HeapDumpOnOutOfMemoryError
which tells the JVM to automatically generate a heap dump when an OutOfMemoryError occurs, and the argument -XX:HeapDumpPath
to specify the path for the heap dump.
如果无法升级JRE以使用服务器中的工具JRE 7(),您可能需要考虑第三方分析工具,如或者列表。
If you cannot upgrade your JRE to use tools like the ones in the server JRE 7 (http://www.oracle.com/technetwork/java/javase/downloads/server-jre7-downloads-1931105.html), you may have to consider third-party profiling tools like JProfiler or ones list here.
这篇关于如何仅使用JRE生成堆转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!