Forum Discussion

sumitbaliyan's avatar
sumitbaliyan
Occasional Contributor
11 years ago

Where to place my .jar in SoapUI directory

Hi,

Looking forward to access java code using SoapUI (free version), but failing to do so. Listing below the 'java code + Groovy Script' and steps i followed, it would be great if I can be guided on this

1. Create code in java using eclipse
package com.sumit;

public class access {

public String access1(){
return "Sumit Baliyan";
}
}

2. Created jar of it
3. Copied jar file in 'lib' folder of SoapUI
4. Now Launched SoapUI
5. Write below code in Groovy Test Step
import com.sumit.*

access ac = new access()
def b = ac.access1()
log.info b
6. Run code and I get this error
groovy.lang.MissingMethodException: No signature of method: Script8.access() is applicable for argument types: (com.sumit.access) values: [com.sumit.access@cc0596]

Note: When i access same jar file in another java program using eclipse it works fine, below is the java code to use jar file code

import com.sumit.access;
public class HelloWorld {
public static void main(String[] args) {
access ac = new access();
String b = ac.access1();
System.out.println(b);
}
}

7 Replies

  • sumitbaliyan's avatar
    sumitbaliyan
    Occasional Contributor
    Also tried saving .jar in "../bin/ext" and re-executing it but that too didn't worked.
  • sumitbaliyan's avatar
    sumitbaliyan
    Occasional Contributor
    Thanks for suggestion but i mostly surfed all links before raising this post and sadly either I could not understand or it just not had answer to my query.
    Searched more and and it seems my earlier opinion was correct to place jar file in 'lib' folder.
    Also it does not look like coding error aswell. May be i am missing some more required setup.
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi,
    it seems the problem comes from the class name. In your example, it starts with a lower case. I am definitely not a Groovy expert but I found what you try to achieve seems not supported in groovy (see http://groovy.329449.n5.nabble.com/Clas ... 72450.html)
    I guess you should be able to reproduce this outside of SoapUI but not with a java main program as you previously did (use a real groovy script)


    could you try to redo a test with a class starting with a upper case letter? This will also follow the Java/Groovy conventions so it should not be an issue in terms of naming :-)
    you could also try to replace
    access ac = new access()
    by
    def ac = new access()
    (may work: http://osdir.com/ml/lang.groovy.user/20 ... 00159.html)
  • sumitbaliyan's avatar
    sumitbaliyan
    Occasional Contributor
    Thanks a lot... you saved my day

    This worked.

    I am also very much new to Groovy, infact to the world of programming. Hard days ahead for Manual Testers