To enable the Java™ virtualization
agent to capture Java method
calls being used by a Java application,
the agent must be loaded into the application's Java virtual machine (JVM). To load the agent
into the application's JVM, modify the startup parameters of the application.
About this task
The
greenhat.javaagent.jar and
greenhat.javaagent.linkage.jar files
provided in
JavaAgent package with
Rational® Test Control Panel must
always be collocated. Otherwise, the Java virtualization
agent will not work correctly.
Note: The registration.xml file
in JavaAgent package does not have to be collocated
with the JAR files, but by default, it is assumed that the file is
collocated with the JAR files. If you want to put the registration.xml file
in a different location, you will need to specify the path to the
file when installing the Java virtualization
agent into a Java application.
Procedure
- Set the Java javaagent property
in the application environment. One way this can be achieved is by
setting the JAVA_TOOLS_OPTIONS environment variable
prior to starting the JMS application. For example, if
the required jars are in the folder C:\RITJavaVirtualizationAgent:
set JAVA_TOOL_OPTIONS="-javaagent:C:\\RITJavaVirtualizationAgent\\greenhat.javaagent.jar"
- If you want to use the Java virtualization
agent with an application server such as IBM® WebSphere® Application Server that
has a Java 2 Security Manager,
the agent might not run and the application server might fail to start
unless you configure the Security Manager correctly.
To
configure a Java 2 Security
Manager to work with the Java virtualization
agent, add a permission of the following format to the
server.policy file:
grant codeBase "file:C:/RITJavaVirtualizationAgent/greenhat.javaagent.jar" {
permission java.security.AllPermission;
};
Note: The example assumes the required jars are
in the folder C:\RITJavaVirtualizationAgent.
Note: If
using WebSphere Application Server,
the server.policy file is located in ${was.install.root}/profiles/${appserver.name}/properties.
Results
Before you can capture any Java method
calls in the Recording Studio perspective, you must create a Java method transport in IBM Rational Integration Tester.