title: How to debug a beanshell script?
body: <p>I have troubles to debug a beanshell script all I get all the time is:</p>
  
  <p>Exception invoking imported object method. : at Line: 194 : in file: inline evaluation of: ``import java.lang.reflect.InvocationTargetException;  import java.util.Arrays;  i . . . '' : migrateModels ( models , apiManager , isSAPRetailImportCondition , isSAPAFSCondition ) </p>
  
  <p>Called from method: initMissingImportSources : at Line: -1 : in file:  : 
  Target exception: java.lang.reflect.InvocationTargetException</p>
  
  <pre><code>at bsh.BshMethod.invoke(Unknown Source)
  at bsh.BshMethod.invoke(Unknown Source)
  at bsh.Name.invokeLocalMethod(Unknown Source)
  at bsh.Name.invokeMethod(Unknown Source)
  at bsh.BSHMethodInvocation.eval(Unknown Source)
  at bsh.BSHPrimaryExpression.eval(Unknown Source)
  at bsh.BSHPrimaryExpression.eval(Unknown Source)
  at bsh.BSHBlock.evalBlock(Unknown Source)
  at bsh.BSHBlock.eval(Unknown Source)
  at bsh.BshMethod.invokeImpl(Unknown Source)
  at bsh.BshMethod.invoke(Unknown Source)
  at bsh.BshMethod.invoke(Unknown Source)
  at bsh.This.invokeMethod(Unknown Source)
  at ImportSourceMigration.initMissingImportSources(BeanShell Generated via ASM (www.objectweb.org))
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:585)
  at bsh.Reflect.invokeMethod(Unknown Source)
  at bsh.Reflect.invokeObjectMethod(Unknown Source)
  at bsh.Name.invokeMethod(Unknown Source)
  at bsh.BSHMethodInvocation.eval(Unknown Source)
  at bsh.BSHPrimaryExpression.eval(Unknown Source)
  at bsh.BSHPrimaryExpression.eval(Unknown Source)
  at bsh.BSHBlock.evalBlock(Unknown Source)
  at bsh.BSHBlock.eval(Unknown Source)
  at bsh.BSHBlock.eval(Unknown Source)
  at bsh.BSHTryStatement.eval(Unknown Source)
  at bsh.Interpreter.eval(Unknown Source)
  at bsh.Interpreter.eval(Unknown Source)
  at bsh.Interpreter.eval(Unknown Source)
  at bsh.servlet.BshServlet.evalScript(Unknown Source)
  at bsh.servlet.BshServlet.doGet(Unknown Source)
  </code></pre>
  
  <p>I am trying to retrieve the full stack trace with this code</p>
  
  <pre><code>    try {
          migration.initMissingImportSources();
      } catch (java.lang.Throwable e) {
          print(ExceptionUtils.getFullStackTrace(e));
      }
  </code></pre>
  
  <p>Is there a possibility to retrieve the causing exception?</p>
  
  <p>Thanks a lot.</p>