Then remote Application Server:
this means that it will generate jprofiler_agent_linux-x64.tar.gz in c:\temp
you must previously have copied startWebLogic.sh (from the DOMAIN_HOME/bin folder) to your c:\temp folder. In the snapshot below I have tried with startManagedWebLogic.sh, but this is NOT recognized as a valid script.... please replace it with startWebLogic.sh script!
as said, startManagedWebLogic.sh is not recognized... use startWebLogic.sh instead!
this time it will work:
and at this point we are ready to attach:
but fiirst you must prepare the Application Server (the Managed Server)
sudo mkdir /opt/jprofiler
sudo chmod soa:soa /opt/jprofiler
The file jprofiler_agent_linux-x64.tar.gz will be created in c:\temp. Copy it to the /opt/jprofiler folder, then:
tar xvzf jprofiler_agent_linux-x64.tar.gz
and that's it for the libraries.
The modification done in startWebLogic.sh is:
added on top:
JAVA_VENDOR=Sun
added above this line: echo "starting weblogic with Java version:":
JAVA_VM= export JAVA_VM JPROFILER_OPTIONS="-agentpath:/opt/jprofiler/bin/linux-x64/libjprofilerti.so=port=8849,nowait $JPROFILER_OPTIONS" export JPROFILER_OPTIONS
changed:
echo "starting weblogic with Java version:" ${JAVA_HOME}/bin/java ${JAVA_VM} -version if [ "${WLS_REDIRECT_LOG}" = "" ] ; then echo "Starting WLS with line:" echo "${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}" ${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS} else echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}" ${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS} >"${WLS_REDIRECT_LOG}" 2>&1 fi
The JPROFILER_OPTIONS add a agentpath pointing to the jprofiles libraries in charge of doing the instrumentation and profiling.
BEWARE: if you copy the startWebLogic_jprofiler.sh from a different domain, make sure you change the DOMAIN_HOME !
At this point we must change the startManagedWebLogic.sh and startWebLogic.sh scripts to add the JProfiler libraries.... we shall clone the existing scripts, to allow normal operations to be unaffected.
cd DOMAIN_HOME/bin
cp startManagedWebLogic.sh startManagedWebLogic_jprofiler.sh
vi startManagedWebLogic_jprofiler.sh
change the 2 occurrences of startWebLogic.sh into startWebLogic_jprofiler.sh
copy to DOMAIN_HOME/bin the startWebLogic_jprofiler.sh generated by the jprofiler wizard
to start the profield server, run ./startManagedWebLogic_jprofiler.sh osbpp4ms1 (or whatever is your managed server name).
In the logs you should see:
JProfiler> Protocol version 37 JProfiler> Using JVMTI JProfiler> JVMTI version 1.1 detected. JProfiler> 64-bit library JProfiler> Don't wait for frontend to connect. JProfiler> Starting up without initial configuration. JProfiler> Listening on port: 8849. JProfiler> Instrumenting native methods. JProfiler> Can retransform classes. JProfiler> Can retransform any class. JProfiler> Native library initialized JProfiler> VM initialized JProfiler> Hotspot compiler enabled
And you are ready to connect and profile.
Happy profiling!
1 comment:
awesome man, worked for me like a charm
had to change "JPROFILER_OPTIONS" as well to my local location.
Post a Comment