系统宕机了,weblogic生成 .phd 和 javacore文件,分别使用 jca457.jar 和 ha456.jar来分析,但是heapdump文件分析时指向的问题和内存泄漏点类并不是很方便对应我们的代码,所以想使用mat工具来分析,但是需要生成 hprof文件
需要修改startWebLogic.sh文件,宕机时就会自动生成对应的hprof文件
LOG_OPTIONS="-Xloggc:$LOG_PATH/gc.$$.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:HeapDumpPath=$LOG_PATH/heapdump.$$.hprof -XX:ErrorFile=$LOG_PATH/hs_err_pid.$$.log"
#!/bin/sh
# WARNING: This file is created by the Configuration Wizard.
# Any changes to this script may be lost when adding extensions to this configuration.
# --- Start Functions ---
stopAll()
{
# We separate the stop commands into a function so we are able to use the trap command in Unix (calling a function) to stop these services
if [ "X${ALREADY_STOPPED}" != "X" ] ; then
exit
fi
# STOP DERBY (only if we started it)
if [ "${DERBY_FLAG}" = "true" ] ; then
echo "Stopping Derby server..."
${WL_HOME}/common/derby/bin/stopNetworkServer.sh >"${DOMAIN_HOME}/derbyShutdown.log" 2>&1
echo "Derby server stopped."
fi
ALREADY_STOPPED="true"
}
classCaching()
{
echo "Class caching enabled..."
JAVA_OPTIONS="${JAVA_OPTIONS} -Dlaunch.main.class=${SERVER_CLASS} -Dlaunch.class.path="${CLASSPATH}" -Dlaunch.complete=weblogic.s
# WARNING: This file is created by the Configuration Wizard.
# Any changes to this script may be lost when adding extensions to this configuration.
# --- Start Functions ---
stopAll()
{
# We separate the stop commands into a function so we are able to use the trap command in Unix (calling a function) to stop these services
if [ "X${ALREADY_STOPPED}" != "X" ] ; then
exit
fi
# STOP DERBY (only if we started it)
if [ "${DERBY_FLAG}" = "true" ] ; then
echo "Stopping Derby server..."
${WL_HOME}/common/derby/bin/stopNetworkServer.sh >"${DOMAIN_HOME}/derbyShutdown.log" 2>&1
echo "Derby server stopped."
fi
ALREADY_STOPPED="true"
}
classCaching()
{
echo "Class caching enabled..."
JAVA_OPTIONS="${JAVA_OPTIONS} -Dlaunch.main.class=${SERVER_CLASS} -Dlaunch.class.path="${CLASSPATH}" -Dlaunch.complete=weblogic.s

当系统宕机且weblogic生成的.phd和javacore文件无法直观定位内存问题时,文章介绍了如何通过修改startWebLogic.sh脚本,配置生成hprof文件以便使用MAT工具进行更有效的内存泄漏分析。通过添加LOG_OPTIONS参数,可以设置heapdump路径和错误日志路径,便于在故障时自动生成hprof文件。
最低0.47元/天 解锁文章
826

被折叠的 条评论
为什么被折叠?



