views:

860

answers:

3

Hey Guys,

I have troubles to debug a beanshell script all I get all the time is:

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 )

Called from method: initMissingImportSources : at Line: -1 : in file: : Target exception: java.lang.reflect.InvocationTargetException

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)

I am trying to retrieve the full stack trace with this code

 try {
  migration.initMissingImportSources();
 } catch (java.lang.Throwable e) {
  print(ExceptionUtils.getFullStackTrace(e));
 }

Is there a possibility to retrieve the causing exception?

Thanks a lot.

A: 

What is you "ExceptionUtils.getFullStackTrace()" really doing? Are you sure it's printing the nested exception?

Damien B
A: 

Hey Damien B!

Thanks a lot for the reply. Yes the getFullStackTrace is from apache commons and should work. I found the problem. The point is here that I didnt have the complete script in one method call. This is important, only then you are able to surround it with a try catch and see the exception. Hope that will helpful for the others in the future too. I see the exception now. I had several methods calling each other.

Cheers,

Denis.

Denis
A: 

Hi Denis. Instead of answer you, I have a question for you ;). In my project we use beanshells but We cannot debug them, how do you configure Eclipse to debug beanshells? Thanks!.