Forum Discussion

sriramdvhere's avatar
sriramdvhere
Occasional Visitor
6 years ago

how to user my .jar file in soapui opensource

I am not able to use the jar i have written Compilation Error is thrown when trying to import my package. please help on this.

 

I have written a java class as below:

 

package com.sriram;

public class ExperimentalClass{

public static String getAuthorName(){

String name = "Sriram";
return name;

}

}

 

and created executable JAR file using eclipse for the above code.

 

And I have imported the executable JAR to the bin/ext folder and lib folder and restarted soapUI.

 

But when trying to use the my java class using the below script, The following exception is thrown.

import com.sriram.ExperimentalClass;

String val = ExperimentalClass.getAuthorName();

log.info (val)

Exception thrown is 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script10.groovy: 1: unable to resolve class com.sriram.ExperimentalClass @ line 1, column 1. import com.sriram.ExperimentalClass; ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class com.sriram.ExperimentalClass @ line 1, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:146) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1145) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:141) at org.codehaus.groovy.control.CompilationUnit$10.call(CompilationUnit.java:632) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:912) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:574) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:523) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613) at groovy.lang.GroovyShell.parse(GroovyShell.java:625) at groovy.lang.GroovyShell.parse(GroovyShell.java:652) at groovy.lang.GroovyShell.parse(GroovyShell.java:643) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:138) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:89) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:141) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:250) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 1 error

Please help on this to correctly import the java class to use it in my code.