I am trying to run HP LoadRunner (wlrun.exe) command from Java Program and check the status at the exit of wlrun.exe command.
Sample Java Code:
public class LRTest
{
private static int exitValue = -1;
private class WlRunExecution extends Thread
{
Process p;
String command = new String();
public WlRunExecution(String command)
{
this.command = command;
}
public void run()
{
LRTest.exitValue = -1;
try
{
this.p = Runtime.getRuntime().exec(this.command);
while (IsLoadRunnerRunning())
{
Thread.sleep(1000L);
}
}
catch (Exception e)
{
System.out.println(e);
}
}
public boolean IsLoadRunnerRunning()
{
boolean IsLoadRunnerRunning = false;
try
{
LRTest.exitValue = this.p.exitValue();
}
catch (IllegalThreadStateException e)
{
IsLoadRunnerRunning = true;
}
return IsLoadRunnerRunning;
}
}
public static void main(String[] arg)
{
LRTest test = new LRTest();
test.runTest();
}
public void runTest()
{
WlRunExecution process = null;
String command = "\"C:\\Program Files (x86)\\HP\\LoadRunner\\bin\\Wlrun.exe\" -Run -TestPath \"C:\\Test\\LoadRunner\\TestBing\\ScenarioBing.lrs\" -ResultName \"C:\\Test\\LoadRunner\\TestBing\\LRResult\"";
//String command = "\"C:\\Program Files (x86)\\HP\\LoadRunner\\bin\\Wlrun.exe\"";
try
{
process = new WlRunExecution(command);
Thread t = new Thread(process);
t.start();
t.join();
System.out.println("Process Exit code : " + exitValue);
}
catch (Exception e)
{
System.out.println(e.getMessage() + e);
}
}
}
On running the program, **Process Exit Code is always 1** which means wlrun process is exited with some error. Even if I run "wlrun" without any argument and manually close the LoadRunner Controller after launch, still process exit code is 1. If I replace "wlrun.exe" with any other command (notepad,exe or AnalysisUI.exe or VuGen.exe) then Process Exit Code is 0.
On debugging, I observed following error in Application Event Logs (Control Panel -> Administrator Tools -> Computer Management -> Event Viewer -> Windows Logs -> Application). Everytime I run HP LoadRunner Controller, this warning is logged in application event log.
HP.LT.Logger configuration failed creating context provider of the type: HP.PC.Security.SSO.AppContextLoggingProvider, HP.PC.Security.SSO
Please help in resolving this issue.