Java Record Replay Protocol Overview

The Java Record Replay (JRR) protocol enables full VuGen functionality when recording a script on a Java application or applet. VuGen creates a script in pure Java and enhances it with Java-specific functions.

Supported Java Communication Protocols

VuGen supports a variety of different communication protocols for Java applications:

Protocol Description
  • See Working with RMI
  • See Working with CORBA
  • See Working with Jacada
  • JMS (Java Message Service). Supports messaging between computers in a network
    JDBC (Java Database Connectivity) Used for defining how a client may access a database

    VuGen's built-in support for the Java protocols utilizes hook files to define how different classes communicate with each other. For information on the hook file structure, see Hook File Structure.

    By default, VuGen only records client side activity in a script, which then emulates the load on the server. You must edit the hook file to change the actions recorded by VuGen. To manually edit the hook file, see Java Custom Filters Overview.

    Note: If you are recording a script that does not use one of the supported protocols (RMI, CORBA, JMS, Jacada. JDBC), you must define your own hook file otherwise your Vuser script will be empty.

    For Java 8 and later: When more than one JDK/JRE is available, the JDK/JRE selection works as follows:

    • For recording, the JRE is selected by the recorded application configuration.
    • For code generation, the following methods are used to select the JRE. Each method is attempted in the order given, and the first to succeed is used.

      1. Use the LR_JAVA_HOME environment variable. You create this variable if you want to use it to select the JRE.
      2. Use the same JRE used for recording.
      3. The code generation infrastructure searches for a java.exe using the default Windows application search algorithm. The user has no control over which JRE is used.
    • For replay, you can specify a JDK using the Java Environment runtime settings.

    Back to top

    Before Recording a JRR Script

    In order to successfully record a script, you must install JDK on the VuGen machine before recording a script. JRE alone is insufficient. Ensure that the classpath and path environment variables are set according to the JDK installation instructions.

    In addition, set the VuGen Java VM and Classpath runtime setting, under Java Environment.

    To replay with a 64-bit JDK, in the Runtime Settings, specify the JDK path in Java VM and select the check box Miscellaneous > Replay script with 64-bit.

    After recording, you can enhance or modify the script with standard Java code using JDK libraries or custom classes. VuGen utilizes the standard Java compiler, javac.exe, to compile the script. Once the script is successfully compiled you can incorporate it into a LoadRunner scenario or Business Process Monitor configuration.

    Back to top

    Notes and limitations

    • VuGen provides a tool that enables you to convert a script created for Web, into Java. For more information, see Convert a Web - HTTP/HTML Vuser Script into a Java Vuser Script.

      Note: By default, Java 7 enables the Java Split Verifier. This prevents Java recording. VuGen uses the -XX:-UseSplitVerifier key while initializing the JVM during recording, to disable the verifier. This adaptation does not require any user intervention.

    • Although .NET-based and Java protocols support creating threads, we recommend that you do not use background threads in real load testing scenarios because:

      • Threads can degrade tests scalability
      • Threads can affect performance measurements.
      • The utility functions' behavior is undetermined if called from any thread except the Vuser main thread, which runs the vuser_init, Action and vuser_end actions. This applies to all functions named lr*.

    Back to top