title: java.lang.Exception: No signature of method: static java.util.Base64$Encoder.encodeToString() is applicable for argument types: ([B)
body: <p>I got this piece of code in <code>Groovy</code>:</p>
  
  <pre><code>def getPhoto(params){
      def data = entity.find(params).first();
      byte[] mybyte = (byte[]) data.photo;
      String str = java.util.Base64.Encoder.encodeToString(mybyte);
      return str;
  }
  </code></pre>
  
  <p>But when this code is executed it throws an <strong>error</strong> saying:</p>
  
  <pre><code>java.lang.Exception: No signature of method: static java.util.Base64$Encoder.encodeToString() is applicable for argument types: ([B) values: {[-1, -40, -1, -32, 0, 16, 74, 70, 73, 70, 0,...too long...
  </code></pre>
  
  <p><strong>UPDATED</strong></p>
  
  <pre><code>org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not find which method &lt;init&gt;() to invoke from this list:
    private java.util.Base64$Encoder#&lt;init&gt;(boolean, [B, int, boolean)
     java.util.Base64$Encoder#&lt;init&gt;(boolean, [B, int, boolean, java.util.Base64$1)
          at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2419)
          at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1250)
          at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1182)
          at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:805)
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNewN(ScriptBytecodeAdapter.java:227)
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNew0(ScriptBytecodeAdapter.java:234)
          at JobSearchService.getPhoto(script1000034.groovy:113)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
          at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
          at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:333)
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:77)
          at JobSearchService$_search_closure2.doCall(script1000034.groovy:59)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
          at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
          at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
          at groovy.lang.Closure.call(Closure.java:292)
          at groovy.lang.Closure.call(Closure.java:305)
          at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1078)
          at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1055)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:51)
          at org.codehaus.groovy.runtime.metaclass.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:54)
          at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
          at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)
          at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
          at JobSearchService.search(script1000034.groovy:57)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
          at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
          at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:497)
          at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
          at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:226)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:754)
          at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:765)
          at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:753)
          at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:167)
          at JobSearchService.invokeMethod(script1000034.groovy)
          at com.rameses.osiris3.script.ScriptExecutor.invokeMethod(ScriptExecutor.java:41)
          at com.rameses.osiris3.script.ManagedScriptExecutor$1.call(ManagedScriptExecutor.java:142)
          at com.rameses.osiris3.script.InterceptorChain.fireChain(InterceptorChain.java:79)
          at com.rameses.osiris3.script.ManagedScriptExecutor.execute(ManagedScriptExecutor.java:140)
          at com.rameses.osiris3.script.ScriptRunnable.run(ScriptRunnable.java:62)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  error class java.lang.Exception Could not find which method &lt;init&gt;() to invoke from this list:
    private java.util.Base64$Encoder#&lt;init&gt;(boolean, [B, int, boolean)
     java.util.Base64$Encoder#&lt;init&gt;(boolean, [B, int, boolean, java.util.Base64$1)
  </code></pre>