javaeclipsehp-quality-centercom4j

Connecting to HPQC from 64bit JAVA


While trying to cennect HPQC from a 64bit machine(having 64bit JAVA, and ECLIPSE), I am getting the below mentioned exception:

Exception in thread "main" com4j.ExecutionException: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j.cpp:153 at com4j.ComThread.execute(ComThread.java:203) at com4j.Task.execute(Task.java:25) at com4j.COM4J.createInstance(COM4J.java:97) at com4j.COM4J.createInstance(COM4J.java:72) at com.qc.ClassFactory.createTDConnection(ClassFactory.java:16) at com.java.Test.main(Test.java:25) Caused by: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j.cpp:153 at com4j.Native.createInstance(Native Method) at com4j.COM4J$CreateInstanceTask.call(COM4J.java:117) at com4j.COM4J$CreateInstanceTask.call(COM4J.java:104) at com4j.Task.invoke(Task.java:51) at com4j.ComThread.run0(ComThread.java:153) at com4j.ComThread.run(ComThread.java:134)

PFB my code:

public static void main(String[] args) { // TODO Auto-generated method stub

    //QC url
    String url = "https://qc_link/qcbin";
    //username for login
    String username = "username";
    //password for login
    String password = "password";
    //domain
    String domain = "domain";
    //project
    String project = "project";

    ITDConnection itdc = ClassFactory.createTDConnection();

    System.out.println("Connecting");

    itdc.initConnectionEx(url);
    itdc.connectProjectEx(domain, project, username, password);

    System.out.println("Connected......");
}

}

The above code works fine for 32bit Java and Eclipse.

Any help would be highly appreciated.

Regards, Parag


Solution

  • The COM API's are 32-bit only and cannot be accessed by a 64-bit process. I have the same problem with .NET applications where I'm stuck in 32-bit until I can move to the REST API (which is bit-less) or host my COM-reliant code in an external process.