Script1.groovy: 3: unable to resolve class org.apache.commons.net.ftp.FTPClient @ line 3, column 1
I am using the SoapUI 5.2.1 to run a FTP related test case. The following script worked fine in my window 7, the it failed if I ran it on windows 8.1 Pro. Not sure why?
import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPConnectionClosedException;
//import org.apache.commons.net.ftp.* (tried this, but still see the error for FTPClient)
new FTPClient().with {
connect "172.16.5.180"
log.info replyString
login "anonymous",""
log.info replyString
changeWorkingDirectory("files/");
files = listFiles(".")
context.mTime="19700101000000"
for (myfiles in files) {
if(myfiles.getName() =~ "trouble_report.tgz") {
context.mTime = getModificationTime(myfiles.getName())
log.info "Found file, modified : " + context.mTime;
}
}
disconnect();
return context.mTime
}
***************************************************************************************
Below is the output error messages:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script3.groovy: 2: unable to resolve class org.apache.commons.net.ftp.FTP
@ line 2, column 1. import org.apache.commons.net.ftp.FTP; ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.commons.net.ft
p.FTP @ line 2, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:146) at org.codehaus.groovy.control.Res
olveVisitor.visitClass(ResolveVisitor.java:1145) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:141) at org.codehaus.gro
ovy.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(Compilati
onUnit.java:523) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.j
ava:258) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:613) at groovy.lang.GroovyShell.parse(GroovyShell.java:625) at groovy.lang.GroovyShell.par
se(GroovyShell.java:652) at groovy.lang.GroovyShell.parse(GroovyShell.java:643) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.co
mpile(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.Gr
oovyScriptStepDesktopPanel$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) Script3.groovy: 3: unable to resolve class org.
apache.commons.net.ftp.FTPClient @ line 3, column 1. import org.apache.commons.net.ftp.FTPClient
**************************************************************************************
What maybe wrong?
Thank you,
Susan
From your error message it looks like you are using the Apache commons Net library:
https://commons.apache.org/proper/commons-net/
My guess is that you have two installs of SoapUI, one has the libraies installed, the other doesn't, you can download the libraries from the above link, and then put them in your bin/ext directory. See the following page for details:
https://support.smartbear.com/readyapi/docs/testing/scripts/about.html