Forum Discussion

RagsKasthuri's avatar
RagsKasthuri
New Contributor
3 years ago

Groovy jar import on SOAP UI Groovy Script

Hi everyone,

 

I created JAR file of my Groovy class.

The JAR file has only one class TestEvidence.groovy inside Utilities folder.

 

When I import the JAR file on the groovy script in SOAP UI, I'm receiving,

Unable to resolve class Utilities.TestEvidence.

 

In other words, in my SOAP UI groovy script, my couple of lines of code are:

import Utilities.TestEvidence

log.info "Going to call Test Evidence groovy code as I run the REST api from SOAPUI"

 

Any pointers why I'm unable to resolve the class Utilities.TestEvidence please?

 

Thanking you,

Raghavan Kasthuri

  • Did you pasted your jar in the lib folder ? if not then please paste your jar in the lib folder and restart the soapui and then try it

  • Hi Shashavali,

    Many thank you for the reply. The problem was with the jar file created. 

    I created the jar file from command line: jar cvfm Automate.jar Automate.class 

    The jar file had the Automate.class file and the manifest file. 

    However, when I created the jar file from IntelliJ IDEA, copying and pasting the jar file on to SOAPUI\bin\ext folder solved the problem.

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 1

    Hello RagsKasthuri 

     

    Are you sure you created your JAR file correctly?  I just experienced this same issue... 

    What I did first was...

    compile- groovyc to create .class file

    jar- jar to create .jar file from .class  --- output of jar creation only showed manifest and .class file in output.

     

    Used the jar file that was created and put in Smartbear .lib folder with all the rest of the .jar files.

    when I ran my script that accesses my new .jar, I got your message "unable to resolve class"...

     

    I then rebuilt .jar with the source .groovy file and the compiled .class file with both in same directory.  I noticed the jar built with the source file this time where the first time it did not show in the verbose output.  Copied this new improved .jar file to Smartbear .lib folder and ran my test step groovy script again that would access my class and I had success.

     

    Long story short... try build of your jar to include source file if you didn't for your attempt.

     

    Regards,

    Todd

     

     

     

  • Hi TNeuschwanger 

    Both compiling of groovy module and creating the jar file from IntelliJ IDEA produced successful results.

    In other words, I compiled the code and later generated the jar file from IntelliJ IDEA.

    The jar file of the groovy module worked successfully with SOAP UI.

    Thank you to IntelliJ IDEA for the same.

    Kindest regards,

    Raghavan