我已使用 EMC Documentum 基础类在 documentum 存储库中执行一些操作。该代码运行良好。我将该项目导出为可运行的 JAR,然后尝试运行它。但是我收到以下错误,但我无法理解它。
这是 DocMovementHandler.getSession() 的代码 实际上这不是新代码,而是获取 documentum session 的常规代码
public IDfSession getSession(String userName, String password)
{
DfClientX clientx = null;
IDfClient client = null;
IDfSession session = null;
try {
// create a client object using a factory method in DfClientX
clientx = new DfClientX();
client = clientx.getLocalClient(); //takes time
// call a factory method to create the session manager
IDfSessionManager sessionMgr = client.newSessionManager();
// create an IDfLoginInfo object and set its fields
IDfLoginInfo loginInfo = clientx.getLoginInfo();
loginInfo.setUser(userName);
loginInfo.setPassword(password);
// set single identity for all docbases
sessionMgr.setIdentity("xyz_repo", loginInfo);
session = sessionMgr.getSession("xyz_repo"); //takes time
//sessionMgr.beginTransaction();
System.out.println("Session obtaied.");
}
catch (DfServiceException dse)
{
DfLogger.debug(this, "Error while beginning transaction. ", null, dse);
dse.printStackTrace();
}
catch (Exception e)
{
DfLogger.debug(this, "Error while creating a new session. ", null, e);
e.printStackTrace();
}
return session;
}
第 38 行是 client = clientx.getLocalClient();
最佳答案
InitationTargetException
是一个包装器。它表示“此反射调用后面发生了异常”,您可以使用 getCause() 来获取内部异常。
堆栈跟踪包含内部异常。这是一个ExceptionInInitializerError
。那是另一个 wrapper 。它说,“无论你做什么都会导致加载一个新类,并且该类的静态初始化程序引发异常”。
此链中的最后一个异常是 NullPointerException
。这就是你需要解决的问题。这意味着您需要调试这个 com.documentum
东西。正如评论所指出的,这并不容易。
关于Java 调用目标异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20004011/