Thanks Andy and Adams' great idea and Support!!
0. download PsTools and SendSignal and gawk into your target machine as PS_TOOLS_HOME
1. Add -XX:+HeapDumpOnCtrlBreak in your JVM arguments
2. Using SendSignal to simulate the Ctl+Break signal to the service
here is the HeapGen.bat file, hope this helps you too:
@echo off
rem -------------------------------------------------------------------------
rem Invoking Remote JVM to do Heap Dump Script for Win32
rem 1. Please replace your directory of PsTools
rem 2. Please set IP before execute it
rem -------------------------------------------------------------------------
set PS_TOOLS_HOME=D:\\PsTools
set JVM_IP=10.279.33.33
set HPROF_HOME=D:\abc\efg\bin
echo ===================================================================================
echo .
echo Your Directory of PsTools is %PS_TOOLS_HOME%
echo .
echo The Remotely Controlled Machine is %JVM_IP%
echo .
echo Heap dump is created in a file in the working
echo directory of the VM namely %HPROF_HOME%
echo .
echo ===================================================================================
echo .
%PS_TOOLS_HOME%\pslist \\%JVM_IP% -u "${Domainname}\${yourusername}" -p "${yourpassword}" -e java | %PS_TOOLS_HOME%\gawk "{if($1 ~ /java/) system(\" %PS_TOOLS_HOME%\\psexec \\\\%JVM_IP% -d -c %PS_TOOLS_HOME%\\SendSignal \" $2)}"
echo .
echo ===================================================
echo .
echo Heap Dump file has been created
echo .
echo ===================================================
echo .
No comments:
Post a Comment