我正在尝试在 Win7 上的 eclipse 中使用 com4j 库连接到 hp qc 版本 10.00
我按照以下步骤操作:
- 使用 tlbimp.jar 创建 OTAClient.dll 的包装器
- 使用 regsvr32 注册 OTAClient.dll
- 在程序中导入了 OTAClient Wrapper。
- 导入 com4j 库。
使用以下代码:
import ota.ClassFactory;
import ota.ITDConnection;
public class comqc {
public static void main(String args[]){
ITDConnection td = ClassFactory.createTDConnection();
td.initConnectionEx("https://qcbt10.saas.hp.com/qcbin/start_a.htm");
System.out.println(td.connected());
td.connectProjectEx(domain, project, username, password);
}
}
获得以下输出:
true
Exception in thread "main" com4j.ComException: 80000482 (Unknown error) : Invalid server response : .\invoke.cpp:517
at com4j.Wrapper.invoke(Wrapper.java:166)
at $Proxy5.connectProjectEx(Unknown Source)
at qctools.main(qctools.java:15)
Caused by: com4j.ComException: 80000482 (Unknown error) : Invalid server response : .\invoke.cpp:517
at com4j.Native.invoke(Native Method)
at com4j.StandardComMethod.invoke(StandardComMethod.java:42)
at com4j.Wrapper$InvocationThunk.call(Wrapper.java:335)
at com4j.Task.invoke(Task.java:51)
at com4j.ComThread.run0(ComThread.java:153)
at com4j.ComThread.run(ComThread.java:134)
出了什么问题?
最佳答案
尝试将 https://qcbt10.saas.hp.com/qcbin
作为连接目标。
OTA引用(OTA_API_Reference.chm)中有很多示例;尽管是用 Basic 编写的,但它们应该很容易翻译为 Java。
关于java - 使用 com4j 连接到 HP Quality Center 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17940868/