Error: “-22992 Can’t find Actions.class” when running a Java Vuser script

Error: "-22992 Can’t find Actions.class" when running a Java Vuser script

The following errors occur when running a Java Vuser script:

"-22992 Can’t find Actions.class"

"-22997 Java Vuser Compilation failed"

Make sure that there is a file named "Actions.class" within the script directory. This is the Java bytecode file generated from compiling Actions.java. If this file does not exists, there could be a compilation problem. Please refer to LoadRunner Java Environmental Requirements for details on setting up the Java environment on the machine.

If the file exits, verify the folllowing:
1. Ensure the <JDK>\bin and <LoadRunner>\bin directories are in the PATH environment variable.

2. Ensure <LoadRunner>\classes, <LoadRunner>\classes\srv, and <JDK>\jre\lib\rt.jar are in the CLASSPATH environment variable (preferably at the beginning of the entry).

3. Add any necessary application CLASSPATHs to environment variable.

4. Remove potentially conflicting entries in both the PATH and CLASSPATH entries (sometimes having the Java environment set up for WinRunner will conflict with the LoadRunner compilation process).

5. Make sure to restart the Controller or VuGen in order to have changes in steps 1-4 registered.

6. If the script was working and started to throw the above error for no obvious reasons, try to clean up the initialization files and reregister LoadRunner’s DLL. To reregister the DLLs and recreate the configuration files:

a. Make sure all the LoadRunner applications are closed.
b. Go to <LoadRunner>\bin directory and execute register_vugen.bat.
c. Go to C:\Winnt, back up vugen.ini, then delete the file. LoadRunner will recreate new configuration files when VuGen is launched.

7. The JVM is limited to 56 KB per function. If one or more of the functions within the Actions class is too big, you will get the above error. To resolve this, break the function up into multiple functions.

Example:
The following function has to many lines of code.

public int Action()
{
//Some code…
return 0;
}

Break it up by changing the code to look like the following.

public int Action()
{
action1();
action2();
return 0;
}

public int action1()
{
//Some code…
return 0;
}

public int action2()
{
//Some more code..
return 0;
}

The execution will be exactly the same.

Advertisements

Error: “-22997 Java Vuser Compilation failed” when running a Java Vuser script

Error: "-22997 Java Vuser Compilation failed" when running a Java Vuser script

The following errors occur when running a Java Vuser script:

Error: "-22992 Can’t find Actions.class"

Error: "-22997 Java Vuser Compilation failed"

Make sure that LoadRunner and the Java environment are set up properly.

1. Ensure the <jdk>\bin and <LoadRunner>\bin directories are in the PATH environment variable.

2. Ensure <LoadRunner>\classes, <LoadRunner>\classes\srv, and <JDK>\jre\lib\rt.jar are in the CLASSPATH environment variable (preferably at the beginning of the entry).

3. Add any necessary application CLASSPATHs to the environment variable.

4. Remove potentially conflicting entries in both the PATH and CLASSPATH entries (sometimes having the Java environment set up for WinRunner will conflict with the LoadRunner compilation process).

5. If you are running the script on a remote load generator, make sure that you apply the same update (1-4 ) there, and then, restart the LoadRunner agent.

6. Make sure that any classpaths specified in the Run-Time settings of the script are valid on the load generator machine as well.

How to run multiple Java scripts that require different JDKs on the same Load Generator machine

How to run multiple Java scripts that require different JDKs on the same Load Generator machine

Use Terminal Services

Since multiple JDKs are needed by the different scripts that need to be run concurrently from Controller you can use Terminal Services as an option.

1. Launch the LoadRunner Agent as a process.
2. Before launching the sessions and the respective agents make sure you select Start -> Programs-> Mercury LoadRunner -> Advanced settings -> Agent Configuration -> Enable Terminal Services.
3. Open a different terminal session for each JDK environment on the Load Generator machine. Log in as a different user for each session. You can set up the environment for each user to point to a different JDK.
4. On each session, launch the Agent process. This process will pick up the JDK specified in the environment variable.
5.In the Controller, connect to each session as LG:0, LG:1, LG:2, and come to a "Ready" state. Then, run each script in the session that has the respective JDK.

How to force the Java Vuser to use a different version of Java Virtual Machine

How to force the Java Vuser to use a different version of Java Virtual Machine

The Java Vuser uses the Java Development Kit (JDK) installed locally on the system. How can the user configure Virtual Users to use a different version of JDK?

Add the desired \bin directory to the system PATH variable

Adding <JDK>\bin to the system PATH variable will force the Java Vuser to use it during execution. The system PATH variable can be modified as follows:

1. Right-click on the "My Computer" icon on the desktop.
2. Select Properties -> Advanced -> Environment Variable.
3. Add the desired JDK’s bin directory to the PATH environment variable.
4. Remove the old <JDK>\bin from the PATH variable or it should be after the bin path of the desired JDK.

How to record and replay against a JAR executable

Configure VuGen to record using details from the application`s Manifest.mf file

1. Expand the JAR file using the WinZip utility, and look for the Manifest.mf file.
2. View the manifest file using Notepad, taking note of the defined "Class-Path:" and "Main-class:" sections.
3. Launch VuGen, and select "New Single Protocol, RMI-Java script."
4. At the "Start Recording" prompt, select/define the following:

Application Type: {select Java Application}
App. Main Class: {define as stated in "Manifest.mf" file’s Main-Class}
Working Directory: {Working directory of application}

5. Click on the "Options" button to access the Recording Options. Proceed to the Java Environment Settings: Classpath definition, and add in all the classpath entries as defined in the Manifest.mf file’s Class-Path.
6. If any additional VM parameters are used (e.g., -Djava.naming.provider.url="iiop://websphere"), proceed to define them in Java Environment Settings: Java VM.

Example:
Additional VM Parameters: -Djava.naming.provider.url="iiop://websphere"

Note:
Make sure to add "-Xbootclasspath/p:<LoadRunner>\classes;<LoadRunner>\classes\srv" to the Additional VM Arguments.

7. Start recording.

Note:
For successful replay, ensure that the classpath definitions in the Run-Time Settings are set accordingly as well (same as in Recording Options).

Enabling the hidden debug options of the Java recorder

Enabling the hidden debug options of the Java recorder

In the Recording Options -> Debug tab for a Java Vuser (Java, RMI and CORBA), the user can only view the "Stack trace" and "Stack trace limit" options, by default. There are other hidden options. How can they be enabled?

Set the JavaLevel in the [DynaDlg] section of the vugen.ini file to 3

To view these extra Java debug options:
1. Open vugen.ini.
2. Go to the [DynaDlg] section.
3. Change the JavaLevel to 3.

If the [DynaDlg] section does not exist, add it to the end of the file.

[DynaDlg]
JavaLevel=3

Java Applet does not load during recording of a Web application

Java Applet does not load during recording of a Web application

During recording of a Web application, an Applet normally loads and allows to perform operation.

Under some circumstances, the applet may not load properly during recording with LoadRunner.

Some possible suggestions that may help resolve this issue are

  • Try recording all steps in one Action section in the script. Sometimes changing the action section during recording will produce this type of problem.
  • Modify the Recording Options to enable URL mode recordings. Only use the URL -> Advanced mode if you have specific reasons to do so (and understand what using this mode means). Using this recording mode will make the script less dynamic and harder to maintain.
  • Try recording with the Multi-Protocol Web/Winsock vuser type.
    When recording with this Vuser type, steps that are recognized as Web steps will be recorded as normal web_xxx functions, but other communication (that is not HTTP based) will be recorded as Winsock. This means that more information about the recording can be captured if the application (applet) communicates via some protocol other than HTTP. This may be necessary in order to properly record and replay a site that incorporates an applet that does this.
  • Also, within the Recording Options for the Web/Winsock Vuser type there is a tab called Web Trapping, which affects the method used for capturing the script. Try enabling this in case of problems encountered during recording. This changes the behavior of the recorder to inspect the network packets at a lower level rather than setting up a proxy server to intercept the Web Requests.