title: JMeter groovy language throws 'unable to resolve class' but beanshell or java are fine
body: <p>I am using JMeter 4.0.  Below is some code I have in a JSR223 Sampler.  It looks in a directory and locates a specific file.</p>
  
  <pre><code>//This looks in the test results folder and locates
  //the most recent file with the testReport prefix we are looking for
  
  import org.apache.commons.io.FileUtils; 
  import org.apache.commons.io.filefilter;
  import org.apache.commons.io.filefilter.WildcardFileFilter;
  import org.apache.commons.io.comparator.LastModifiedFileComparator;
  
  //show some logging in the jmeter log and in the jenkins console
  log.info("=== get Test Results File to Upload ===");
  OUT.println("=== get Test Results File to Upload ===");
  
  //put the test_results_path property in a string to make it easier to work with
  String dir_path = props.get("test_results_path");
  log.info("=== test_results_path === "+dir_path);
  OUT.println("=== test_results_path === "+dir_path);
  String rpt_pref = props.get("testReport_prefix");
  //log.info("=== testReport_prefix === "+rpt_pref);
  //OUT.println("=== testReport_prefix === "+rpt_pref);
  String rpt_suff = props.get("testReport_suffix");
  //log.info("=== testReport_suffix === "+rpt_suff);
  //OUT.println("=== testReport_suffix === "+rpt_suff);
  
  //define an empty file
  File theNewestFile = null;
  try {
     File dir = new File(dir_path);
     //log.info("=== file directory === "+dir);   
     //OUT.println("=== file directory === "+dir);   
     FileFilter fileFilter = new WildcardFileFilter(""+rpt_pref+"*."+rpt_suff+"");    
     //log.info("=== fileName === "+fileFilter);
     //OUT.println("=== fileName === "+fileFilter);   
  
     File[] files = dir.listFiles(fileFilter);
     if (files.length &gt; 0) {
          /** The newest file comes first **/
          Arrays.sort(files, LastModifiedFileComparator.LASTMODIFIED_REVERSE);
          theNewestFile = files[0];
          String fileName = files[0].getName().toString();
          log.info("=== File to Upload === "+fileName);
          OUT.println("=== File to Upload === "+fileName);
          props.put("varResultsReportFile",fileName);
     } else if(files.length &lt;= 0) {
              /** no files exist **/
              //theNewestFile = ;
              String fileName = "FILE_MISSING";
              log.error("*FAILED to find file for "+vars.get("testApp")+" ===  "+fileName);
          OUT.println("*FAILED to find file for "+vars.get("testApp")+" ===  "+fileName);
          //SampleResult.setSuccessful(false);
          SampleResult.setStopTestNow(true);
          //SampleResult.setResponseData("FILE_MISSING");
          props.put("varResultsReportFile",fileName);
     }
  
      return theNewestFile;
  }
  catch (Throwable ex) {
     log.error("*FAILED - Something bad happened", ex);
     throw ex;
  }
  </code></pre>
  
  <p>When I run this with Language = BeanShell or Java, it runs fine.  When I try using Language = groovy, it gives me this error:</p>
  
  <pre><code>javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  Script16.groovy: 5: unable to resolve class org.apache.commons.io.filefilter
   @ line 5, column 1.
     import org.apache.commons.io.filefilter;
     ^
  
  1 error
  
      at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.compile(GroovyScriptEngineImpl.java:183) ~[groovy-all-2.4.13.jar:2.4.13]
      at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:215) ~[ApacheJMeter_core.jar:4.0 r1823414]
      at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:69) [ApacheJMeter_java.jar:4.0 r1823414]
      at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490) [ApacheJMeter_core.jar:4.0 r1823414]
      at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416) [ApacheJMeter_core.jar:4.0 r1823414]
      at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250) [ApacheJMeter_core.jar:4.0 r1823414]
      at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]
  Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
  Script16.groovy: 5: unable to resolve class org.apache.commons.io.filefilter
   @ line 5, column 1.
     import org.apache.commons.io.filefilter;
  </code></pre>
  
  <p>I've checked and I seem go have commons-io.jar that comes with jmeter 4.0 in my lib folder.  I upgraded my java jdk to 8_181.  What else can I do?  For now I will run using beanshell but would like to convert to groovy since this is jmeter's preferred language over beanshell</p>