COM4J Error – QueryInterface failed : Access is denied. : .\com4j.cpp

After generating the COM4J code to wrap a COM object, via the tlbimp.jar, I was getting the following error when calling the createComObjectName method on the ClassFactory:

QueryInterface failed : Access is denied. : .\com4j.cpp:163
        at com4j.ComThread.execute(
        at com4j.Task.execute(
        at com4j.COM4J.createInstance(
        at example.ClassFactory.createComObjectName(

The objects being called acts as a proxy to objects residing on another machine. The error is caused by running the COM code under a user account that was unable to access the COM object on the remote server. The COM application the object was part of used the current logged on user for authentication. When I switched to using the user account on the correct domain, the error disappeared.

COM Application Properties

COM Application Properties

This entry was posted in Programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *