Exception in thread "main" com4j.ExecutionException: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j.cpp

tester picture tester · Apr 8, 2013 · Viewed 7.2k times · Source

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.

Answer

RKH picture RKH · Mar 25, 2015

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