3

我在调试 beanshell 脚本时遇到了麻烦,我一直得到的是:

调用导入对象方法的异常。:在第 194 行:在文件中:内联评估:``import java.lang.reflect.InvocationTargetException; 导入 java.util.Arrays;一世 。. . '' : migrateModels (模型, apiManager, isSAPRetailImportCondition, isSAPAFSCondition)

从方法调用:initMissingImportSources:在行:-1:在文件中::目标异常: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)

我正在尝试使用此代码检索完整的堆栈跟踪

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

是否有可能检索导致的异常?

非常感谢。

4

2 回答 2

1

你“ExceptionUtils.getFullStackTrace()”到底在做什么?您确定它正在打印嵌套异常吗?

于 2009-01-24T00:46:51.753 回答
1

非常感谢您的回复。是的 getFullStackTrace 来自 apache commons,应该可以工作。我发现了问题。关键是我在一个方法调用中没有完整的脚本。这很重要,只有这样你才能用 try catch 包围它并查看异常。希望将来也对其他人有所帮助。我现在看到了例外。我有几种方法互相调用。

于 2009-01-26T14:14:45.857 回答