2

OTAClient.dll version 10.0.0.2532

The following is the code I have used to connect to qc, apply filter and fetch qcpath and a field data. It is working fine with java 32 bit version 1.7.

   import com.oracle.qcTasks.ClassFactory;
   import com.oracle.qcTasks.IList;
   import com.oracle.qcTasks.ISubjectNode;
   import com.oracle.qcTasks.ITDConnection;
   import com.oracle.qcTasks.ITDFilter;
   import com.oracle.qcTasks.ITest;
   import com.oracle.qcTasks.ITestFactory;
   import com4j.Com4jObject;

   public class qcClient {

   public static void main(String[] args) {

    ITest qcTestCase;
    ISubjectNode qcTestCasePath;
    Com4jObject SubjectField;
    //QC url
    String url = "http://fusionqc.us.oracle.com/";
    //username for login
    String username = "username";
    //password for login
    String password = "";
    //domain
    String domain = "domain";
    //project
    String project = "project";
    ITDConnection itdc = ClassFactory.createTDConnection();
    itdc.initConnectionEx(url);
    itdc.connectProjectEx(domain, project, username, password);
    boolean flag = itdc.connected();

    System.out.println(itdc.projectName());     
    ITestFactory qcTestFactory = itdc.testFactory().queryInterface(ITestFactory.class);
    ITDFilter qcFilter=qcTestFactory.filter().queryInterface(ITDFilter.class);      


    String query="^Subject\\path^";         
    qcFilter.clear();

    qcFilter.filter("TS_SUBJECT", query);       

    IList qcTestList = qcFilter.newList();      
    for (Com4jObject com4jObject : qcTestList) {
        qcTestCase = com4jObject.queryInterface(ITest.class);
        System.out.println(qcTestCase.name());
        System.out.println(qcTestCase.field("TS_USER_09"));


        SubjectField = (Com4jObject)qcTestCase.field("TS_SUBJECT");
        qcTestCasePath = SubjectField.queryInterface(ISubjectNode.class);
        System.out.println(qcTestCasePath.path());
        break;
    }


    System.out.println("command output :: "+flag);

    System.out.println("OUT");      
    itdc.disconnectProject();


}

}

To the project requirement, I've downgraded the version of java to 64 bit version of 1.6. Post the downgrade, I'm receiving the following error.

      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.oracle.qcTasks.ClassFactory.createTDConnection(ClassFactory.java:16)
at com.oracle.qcCode.qcClient.main(qcClient.java:32)
      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)

I've found similar threads but didn't found any particular solution for the same. Please help. Is there any impact wrt java versions

user3828906
  • 21
  • 1
  • 3

1 Answers1

0

What version of com4j do you use? See this post for using com4j on a 64 bit Windows machine. Are there any COM objects you can use from your 64 bit environment?

According to this blog entry you will get a Class not Registered Exception when you try to access a 32 bit COM object in a 64 bit environment. It even contains a workaround using some registry hacks. Maybe it works?

Community
  • 1
  • 1
Roland
  • 1,220
  • 1
  • 14
  • 29