【问题标题】:Access to a DOORS using Java使用 Java 访问 DOORS
【发布时间】:2017-07-20 09:09:13
【问题描述】:

我想用 Java 从 DOORS 获取数据。我发现我可以使用 Jacob 运行 DOORS,但它不起作用。即使不使用 Jacob,任何人都可以指导我解决问题吗? 如果有人能给我一些具体的代码,我将不胜感激。

我的代码:

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.*;

String dxlFile = "" + appDir + "\\dxl\\transferTraceInfoToDOORS.dxl";
try {
      //Try and get the active instance of doors first
      ComThread.InitMTA();
     //ActiveXComponent runningDoors = new ActiveXComponent("DOORS.Application");

    ActiveXComponent runningDoors = 
                   ActiveXComponent.connectToActiveInstance("DOORS.Application");
   if( runningDoors ==null) {
       JOptionPane.showMessageDialog(null,
             "This application needs an active running instance of DOORS to work,
             please fire DOORS up and try again");
       System.exit(0);
   } else {
       runningDoors.invoke("RunStr", "print(\"Testing\");
       oleSetResult(\"Finished\")");
       //runningDoors.invoke("RunFile", dxlFile);
                System.out.println(runningDoors.getPropertyAsString("Result"));
   }
} catch (Exception e) {
    e.printStackTrace();
}  finally {
    ComThread.Release();
}

当我使用“Excel.Application”时,此代码运行良好,但使用 DOORS 时它不会检测到活动实例所以我收到以下消息:“此应用程序需要一个活动运行的 DOORS 实例才能工作,请启动 DOORS然后再试一次”。请帮我。我找不到解决方案。

谢谢。

【问题讨论】:

  • 你确定dxlFile的路径正确并且存在吗?是否引发异常?
  • 没有检测到正在运行的DOORS活动实例的问题。所以我收到了这条消息:“此应用程序需要一个正在运行的 DOORS 实例才能工作,请启动 DOORS 并重试”。

标签: java jacob ibm-doors


【解决方案1】:

关于 Java 和 DXL 的一般评论可以在https://www.ibm.com/developerworks/community/forums/html/topic?id=269a1e10-da03-4df4-9eaa-1415e30329cb找到

并且:多个DOORS版本的安装程序存在问题,DOORS在安装过程中未能正确注册为COM服务器。详情和建议见https://www.ibm.com/developerworks/community/forums/html/topic?id=c5154866-d0ec-4900-906d-a4c532fc11a4

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-11
    • 2013-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多