Thursday, December 1, 2011

Common Errors with Java Scripts in Controller / Replay

Below are some common issues / errors that are faced while replaying / running java vuser scripts in loadrunner:


"22994 : Error:Unable to create Java VM"

This error usually means that the PATH and the CLASSPATH environment variables are not set properly.
Delete ini file for Vugen:
a. Shutdown Vugen.
b. Go to "Window install directory" and look for vugen.ini. Delete the file. LoadRunner will recreate new configuration file when VuGen is launched.
c. Launch VuGen and run the script again. 



"22997 Java Vuser Compilation failed"

Make sure that LoadRunner and the Java environment are set up properly.
1. Ensure the "jdk install dir"\bin and "LoadRunner Install dir"\bin directories are in the PATH environment variable.
2. Ensure "LoadRunner Install dir"\classes, "LoadRunner Install dir"\classes\srv, and "JDK install dir"\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 QTP  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.


"22992 Can't find Actions.class"

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 exits, there could be a compilation problem. 
If the file exits, verify the folllowing:
1. Ensure the "JDK Install dir"\bin and "LoadRunner Install dir"\bin directories are in the PATH environment variable.

2. Ensure "LoadRunner Install dir"\classes, "LoadRunner Install dir"\classes\srv, and "JDK Install dir"\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 QTP 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 initilization 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 Install dir"\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. 






No comments:

Post a Comment