title: exception "Scripts not permitted to use staticMethod " when running groovy script from jenkinsfile
body: <p>I am trying to execute "myGroovyScript.groovy" from a jenkinsfile which is running at a remote server. Groovy script is kept in a path in server (not checked in scm). But I am getting exception. </p>
  
  <p>My Jenkinsfile is as below:</p>
  
  <pre><code>attempt=1;
  maxAttempt = 90;
  uiNodesReady = false;
  uiFrontDoorReady = false;
  waitTimeMS = 10000;
  node('abcd'){
  
          def buildInput;
  
        echo 'Deploying build'
       if(!params.buildName) {
           buildInput = input(
                            id: 'userInput', message: 'What is the build name?', parameters: [
                            [$class: 'TextParameterDefinition', defaultValue: 'BuildNameIsABC', description: 'Environment', name: 'buildName']
                            ])
        }
        buildToUse = params.buildName ? params.buildName : buildInput;
        echo ("Env: "+buildToUse);
  
        if ( "${params.buildParam}" == 'prequal' || !params.buildParam ){
  
          stage('Prequal') {
                  echo 'Checking prequal status for my product build'
              def rootDir = '/path to myGroovyscript.groovy/'
              def script = load "${rootDir}myGroovyscript.groovy"
            def executeStatus= script.execute('abcd')
  }
  </code></pre>
  
  <p>and my groovy script, which is , "myGroovyScript.groovy" is as below</p>
  
  <pre><code>#!/usr/bin/env groovy
  
  def frontDoorUrl
  def uiNodes
  
  def execute(service) {
  if ("abcd".equalsIgnoreCase(service)) {
      println 'Init config for service abcd'
      frontDoorUrl = "http://myFrontDoorURL"
      uiNodes = ["http://myUINodes"]
  }
  
  //ping nodes &lt;service&gt;
  while (attempt &lt;= maxAttempt &amp;&amp; uiNodesReady == false) {
      println 'Attempt #' + attempt
      for (i = 0; i &lt; uiNodes.size(); i++) {
          def result = ('curl -m 2 --write-out "%{http_code}" ' + uiNodes[i]).execute().text
          println 'UI node: ' + i + ' ::: ' + uiNodes[i] + ' status: ' + result
          if (result.contains("&lt;StatusCode&gt;200&lt;/StatusCode&gt;")) {
              uiNodesReady = true
          } else {
              uiNodesReady = false
              break
          }
      }
  }
  }
  return this
  </code></pre>
  
  <p>I am getting below exception when I am running my jenkins job:</p>
  
  <pre><code>org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods execute java.lang.String
      at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectStaticMethod(StaticWhitelist.java:189)
      at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:102)
      at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:148)
      at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:152)
      at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:16)
      at Script1.execute(Script1.groovy:53)
      at WorkflowScript.run(WorkflowScript:119)
      at ___cps.transform___(Native Method)
      at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
      at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixName(FunctionCallBlock.java:77)
      at sun.reflect.GeneratedMethodAccessor442.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
  </code></pre>