J2EE Request Profiler Probes
Introduction
This sample contains the J2EE Request Profiler Probe used to collect data
from any J2EE application. The probe can be injected into any J2EE application by
following the instructions given below. For more information regarding the Hyades
Probekit, consult the help files. For more information regarding the J2EE Request Profiler,
consult the readme.html file for the 'J2EE Request Profiler Sample' by going to New > Example.
Contents
JAR file |
Description |
j2rp_probe.probe |
This is the J2EE Request Profiler Probe used to collect data from the J2EE applications |
sdrt.jar |
Contains the J2EE Request Profiler with the collaborators disabled. The above Probe is used to do the job of the collaborators. |
Requirements
The WebSphere Application Server (version 5.0 or higher) is required to
execute this sample.
Note: This application is not supplied.
Assumptions
When attaching to a J2EE Request Profiler using the workbench, the Agent
Controller is installed and running.
Execution Steps
Follow the instructions below to apply the probe to a J2EE application and start profiling:
- Stop the WebSphere Application Server (version 5.0 or higher).
- Add the sdrt.jar file from this sample to the lib directory of the
WebSphere Application Server, for example,
x:\Program Files\WebSphere\AppServer\lib on Windows or /opt/WebSphere/AppServer/lib on UNIX.
- Right click on j2rp_probe.probe > probekit > compile
- Compiling your probe should have generated a java class and a probescript file.
If the 'build automatically' option is selected, the java class is compiled and a few
build path errors are displayed. Right click on your project
> Properties > Java Build Path > Libraries > Add External JARs
> Select the location of the sdrt.jar file included with this sample. You can
view the location of this file by right clicking on it and selecting Properties. Also add the
j2ee.jar
file from the lib directory of WebSphere (i.e. <WAS_HOME>\lib\j2ee.jar).
The build path errors should now all be resolved.
-
When the project is built, four .class files are generated under the bin directory of your project
(i.e.<Workbench_Home>\<Workspace>\<Project_Name>\bin). These four class files should be j2rp_probe_probe.class,
j2rp_probe_probe$Probe_0.class, j2rp_probe_probe$Probe_1.class, j2rp_probe_probe$Probe_2.class. Copy these classes
in the same directory as your J2EE application.
-
Ensure that your CLASSPATH environment variable contains the full path and filename of the probekit.jar file. The probekit.jar file is in the org.eclipse.hyades.probekit subfolder of your Eclipse plugins folder.
Ensure that your PATH environment variable contains the full path to a subfolder of org.eclipse.hyades.probekit that is appropriate for your platform:
os\win32\x86 for Windows
os/solaris/sparc for Solaris
os/linux/x86 for Linux
Other platforms will have their own subdirectories.
-
Switch to the <Workbench_Home>\<Workspace>\<Project_Name>\bin directory.
Apply the probe to your J2EE application by using the following command: java ProbeInstrumenter j2rp_probe.probescript "C:\myservlet\myclass.class"
You can also apply the probe to a group of classes by either specifying a directory or a JAR file to the above command.
See the probekit help file for more information regarding the above command.
Note that you cannot apply the probes to classes that have already been instrumented. If you apply the probes to your
classes and wish to apply a modified version of the probe later on to the same set of classes, you should rename all
the *.class.bak files back to *.class before applying the probes.
- Start the WebSphere Application Server.
- Enable profiling in the Profiling and Logging preferences of the
workbench:
- From the toolbar, select Window > Preferences.
- Select Profiling and Logging.
- In the Profiling and Logging pane, select Enable profiling.
- Select OK to apply the changes.
- Open the Profiling and Logging perspective in the workbench:
- Select Window > Open Perspective > Other.
- Select Profiling and Logging.
- Select OK.
- Attach to the J2EE Request Profiler profiling agent:
- Select Profile from the toolbar. The launch configuration window opens.
- Select Attach - Java Process from the Configurations list.
- Click New to create a new configuration.
- In the new configuration pane, specify a name for the profile configuration in the Name field.
- Select the Agents tab.
- Select the J2EE Request Profiler from the Agents list using the arrow keys.
- Click Profile to begin profiling the application.
- In the Profiling Monitor view, right-click on the profiling agent and select Start Monitoring. Data
will now be collected.
- Run your J2EE application.
- Open one of the Profiling and Logging perspective's profiling views to view profiling
data that's collected. To open a view:
- In the Profiling Monitor view, right-click on the profiling agent and select
Open with.
- Select one of the views listed.
Note: More information on application profiling and the profiling
views of the Profiling perspective can be found in the online documentation (Help
> Help Contents > Search: > 'Application Profiling Perspective' > GO).
- In the Profiling Monitor, select the Refresh Views button
to refresh the views.
- Note that you can modify the probes in any way you wish and re-apply it to your classes.
For example, you can target the probes to specific classes/methods by including
<target>
statements such
as the following:
<target type='exclude' package='*' method='myMethod'/>
The user is strongly encouraged to read the probekit help files to determine how the probe files can be modified to best meet
their needs.
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.