LoadRunner Support Forum
Showing results for 
Search instead for 
Do you mean 

Can I write Java code in LoadRunner with Java over HTTP protocol?

Occasional Advisor

Can I write Java code in LoadRunner with Java over HTTP protocol?

Hi,

 

I am experiencing issues for writing java code into generated Actions.java, while the project is using Java over HTTP protocol. As soon as I added the code and try to replay again, I got the following stack:

Error:  at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
 at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
 at DummyClassLoader.loadClass(DummyClassLoader.java:15)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
 at ScriptFactory.getScriptObject(ScriptFactory.java:51)
Error: Can't create script object.
Error: Exception was raised when calling abort-cleanup function in extension java_int.dll: System Exceptions: EXCEPTION_ACCESS_VIOLATION
Warning: Extension trans.dll reports error -1 on call to function ExtAbortCleanup
Notify: Found jdk version: 1.7.0.
Notify: classpath=C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts2\;c:\program files (x86)\hp\loadrunner\classes\srv;c:\program files (x86)\hp\loadrunner\classes;C:\Program Files (x86)\HP\LoadRunner\classes;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\commonapp_transfer_applet.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\commonapp_transfer_business.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\commonapp_transfer_shared.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_request_applet.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_request_shared.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_scheduleplanner_applet.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_scheduleplanner_shared.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_scheduletemplate_applet.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_selfscheduling_applet.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\scheduling_setup_applet.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\wfp_timekeeping_timesheet_shared.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\com.kronos.wfc.exceptions_1.0.0.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\platform_resources_shared.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\platform_security_shared.jar;C:\Users\jjou\Documents\VuGen\Scripts\CreateShifts\Reference\platform_utility_framework.jar;;C:\Program Files (x86)\Java\jdk1.7.0_02\jre\lib;C:\Users\jjou\Downloads\eclipse\plugins;;;c:\program files (x86)\hp\loadrunner\lib\xstream-1.3.jar;c:\program files (x86)\hp\loadrunner\lib\xpp3-1.1.4c.jar
Notify: Path=C:\Program Files (x86)\Java\jdk1.7.0_02\jre\bin\client;C:\Program Files (x86)\Java\jdk1.7.0_02\bin;C:\Program Files (x86)\HP\LoadRunner\Bin;C:\Program Files (x86)\HP\LoadRunner\Bin\tulip\bin;D:\app\jjou\product\11.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft Application Virtualization Client;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_02\jre\bin\;C:\Program Files (x86)\HP\LoadRunner\strawberry-perl\perl\bin
Notify: VM Params: .
Error:  at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
 at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
 at DummyClassLoader.loadClass(DummyClassLoader.java:15)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
 at ScriptFactory.getScriptObject(ScriptFactory.java:51)

Error: Can't create script object.
Error: Exception was raised when calling abort-cleanup function in extension java_int.dll: System Exceptions: EXCEPTION_ACCESS_VIOLATION
Warning: Extension trans.dll reports error -1 on call to function ExtAbortCleanup

 

After searching thru the web sites and found most same issues are due to classpath and path setup. But I have double checked those 2 settings and they seemed to be fine (only one jdk specified).

 

The java code I added is creating ArralyList of objects and do some looping to collect runtime data.

 

Can you help please? I am stuck....

 

9 REPLIES
HPE Expert

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Hi,

 

What LR version do you work with?

Try with JDK, JRE isn't supported for Java protocols family.

JDK 1.7 is supported starting from LR 11.52.

 

Regards,

Sergey

-----
Sergey Kutsos | LoadRunner QA
LoadRunner - Your performance, Our passion!
Occasional Advisor

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Hi,

 

I am using LR 11.52 with JDK 1.7. 

I am using trial version to evaluate its features for Java applets embeded web applications used by our company.  

 

Here is the portion of java code which is httting the issue:

  public static void global_init() throws FileNotFoundException {
    if (ready == false)
      synchronized (lock) {
        if (ready == false) {
        ArrayList<Shifts> shifts = new ArrayList<Shifts>(); // This is the place exception thrown access violation...
        shifts = readCSV("requestBody11.csv",shifts);
        replaceVariables(shifts,"requestBody11.xml");
        RequestObjectListBeanBA0=XmlBasedBinMemoObjectParsing.xml2bin("requestBody8.xml");
        RequestObjectListBeanBA1=XmlBasedBinMemoObjectParsing.xml2bin("requestBody9.xml");
        RequestObjectListBeanBA2=XmlBasedBinMemoObjectParsing.xml2bin("requestBody10.xml");
        ShiftEditorBeanBA3=XmlBasedBinMemoObjectParsing.xml2bin("requestBody11.xml");
        KBeanBA4=XmlBasedBinMemoObjectParsing.xml2bin("requestBody12.xml");
    ready = true;
        }
      }
  }

Frequent Advisor

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Not sure this will help.

Do you want to try using fully qualified names ?

new java.lang.ArrayList instead of short names?

 

Regards,

AJ

HPE Expert

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Can you try to compile script outside VuGen?
Occasional Advisor

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Yes, I can. And I have figured out the issue. The problem is that I create a new .java file with a new class and somehow LR solution project created 2 same file to root and data folder and that caused the access violation... I suspect this would be the issue caused by Eclipse which I use to edit the sources.

 

Removing the file from data folder fixes the problem.

 

BTW, I also experience another issue that whenever I update the my .java file in Eclipse that LR and EClipse won't automatically compile to .class. So when I replay the script LR will not execute properly. I have to manually compile it using javac.exe. Any idea to avoid this manual process? Thanks

 

 

HPE Expert

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Please declare "ArrayList<Shifts> shifts;" outside of the vuser_init, action & end sections and it solves the problem.

Frequent Advisor

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Hi ,

 

I am using  Loadrunner 11.52 but it is  not supporting JDK 1.7. showing  JAVA error.  when recording desktop client server application using JAVA record replay protocol .

 

Please let  me know  if I am doing something wrong .

 

Thanks

Gyanendra

 

Highlighted
HPE Expert

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

Can you post the error you received?

Occasional Visitor

Re: Can I write Java code in LoadRunner with Java over HTTP protocol?

32 bit or 64 bit or both would work?