jacob-project
jacob-project copied to clipboard
com.jacob.com.ComFailException: Can't co-create object
I recently upgraded to JACOB 1.20 and I found a connection attempt failed with the following message: Caused by: com.jacob.com.ComFailException: Can't co-create object
I cannot generate this error deterministically and it rarely appears. I have seen it only on Windows 7. It successfully works on Window 10. I notice that the release notes for 1.20 say "Update to VS2019 Community and Windows 10 libs" I wonder whether those "Windows 10 libs" update could be the cause of the problem.
Any help is appreciated.
Thanks in advance. Sergio
The same error occurs with version 1.19
I recently upgraded to JACOB 1.20 and I found a connection attempt failed with the following message: Caused by: com.jacob.com.ComFailException: Can't co-create object
I cannot generate this error deterministically and it rarely appears. I have seen it only on Windows 7. It successfully works on Window 10. I notice that the release notes for 1.20 say "Update to VS2019 Community and Windows 10 libs" I wonder whether those "Windows 10 libs" update could be the cause of the problem.
Any help is appreciated.
Thanks in advance. Sergio
Hi,I have met this issue yesterday too.According to my several tests,it may caused by two aspects mainly.As following: 1.The path you store the dll file should be %Java_HOME%\jdk\jre\bin or system32/syswow64 which depending on your jdk version. 2.The version of dll must be matched to your jdk version such as 32bit or 64bit.
Can't co-create object
also was also reproducible in 1.18-M2 already.
To find out the cause, it is helpful to inspect the actual HRESULT
produced by ComFailException::getHResult
.
In my case it said 0x80070005
, which means insufficient access right. The cause was that my Java server is powered by a Virtual Service Account on Windows, i. e. with an account that is extremely restricted. The solution was to ask an administrator to grant the needed rights:
- Component Services (
dcomcnfg
)- For the DCOM component (named like the
ProgID
) I had to grantLocal Activation
to the virtual account. I was told this rather exactly by the Windows Event Viewer's "System" log, BTW).
- For the DCOM component (named like the
- Registry (
regedit
)- For the registry key
Computer\HKEY_CLASSES_ROOT\AppID\{...appid...}
I had to grantREAD
access to the virtual account. - For the registry key
Computer\HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{...clsid...}
I had to grantREAD
access to the virtual account (as my COM server is a 32 Bit EXE running on a 64 Bit host).
- For the registry key
After that, everything worked like a charm! 😍
You must ensure that the number of bits of your jdk and the number of files being called are consistent. The reason why I encountered this problem is that the bit number of jdk is inconsistent with the bit number of the called ocx file.