3

I am getting the following error when tried to log a defect in QC.

  • Error is as follows: 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.mercury.qualitycenter.otaclient.ClassFactory.createTDConnection(Unknown Source) at library.DefectDetailsDriver.RaiseDefect(DefectDetailsDriver.java:154) at library.Runner.main(Runner.java:86) 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 am using Win 7 64bit machine, so i downloaded newer version of COM4J and copied com4j-amd64.dll to C:\Windows\System32 and as well as c:\windows\SysWOW64

  • in Windows 32 bit, I am abel to log a defect successfully.

Please help.

tester
  • 263
  • 5
  • 12
  • 27
  • possible duplicate of [How do I register a DLL on Windows 7 64-bit?](http://stackoverflow.com/questions/4897685/how-do-i-register-a-dll-on-windows-7-64-bit) – Simon Mourier Apr 08 '13 at 07:06
  • please note that I am not looking for registering dll in Win 7 64 bit machine. I need help in resolving the above error, I get this error when I tried to log a defect in QC automatically using my java code. I have already downloaded a newer version of COM4J for 64 bit and registered the dll. I am able to log a defect successfully in 32 bit using my java code. Please help on resolving this error in 64 bit machine. – tester Apr 09 '13 at 03:37
  • 2
    "class not registered" means COM can't find the object info in the registry corresponding to the client bitness. If your client app is running as a 64-bit process, you need to register the object in the 64-bit side of the registry. You mention you "copy" the file, this is not enough, you need to register it. – Simon Mourier Apr 09 '13 at 07:26
  • Hi Simon, I registered 'com4j-amd64.dll' to C:\Windows\System32 directory .... still no luck... But, now I am noticing that OTAClient.dll is registered in "C:\Program Files (x86)\HP\...OTAClient.dll"............. Is this a problem? – tester Apr 10 '13 at 04:10
  • 1
    A COM DLL can be anywhere on the disk, but it needs to be registered using the regsvr32.exe (as stated in the link there are two versions of regsvr32.exe one for 32-bit COM DLLs and one for 64-bit COM DLLs). – Simon Mourier Apr 10 '13 at 05:52
  • Did you ever figure this out? I am having the same problem. I have followed every step given and it is still not working – CallSign-Filter Jul 13 '17 at 17:47

2 Answers2

0

Please register OTAClient.dll to avoid this exception. For registration you need following command after copying the file to required folder under Windows.

regsvr32 OTAClient.dll
kapex
  • 28,903
  • 6
  • 107
  • 121
RKH
  • 41
  • 4
0

So I was able to figure this out (finally). What I did was register the .dll that is using com4j (and it’s codebase) with RegAsm through the .Net that was used. In an elevated command prompt, navigate to where your dll that is using com4j and use the following command: Be sure you are using the correct .Net framework for the dll that you are using. C:/Windows/Microsoft.NET/Framework64/v4.0.30319/RegAsm.exe .dll /codebase

CallSign-Filter
  • 1,283
  • 1
  • 9
  • 12