opcdcomscada

00000005: Unknown error (00000005) when trying to connect to OPC Server using Utgard


I am trying to run the main method of UtgardTutorial2 at https://openscada.atlassian.net/wiki/spaces/OP/pages/6094892/HowToStartWithUtgard,to connect to a Makitron OPC Server which is running on the same machine.

I have replaced the values for the Host and Domain with those of the Machine I am using and the user name and password with the username and password of the windows account (which is an administrator) that I am logged into when I run the code.

Instead of using the ProgId, I have set the Clsid to that of the Server I am trying to connect to.

I have enabled Distributed COM on the computer and have given my user all permissions in the DCOM configuration of the server and OpcEnum.

When I run the code I get the following error,

946 [main] INFO org.openscada.opc.lib.da.Server - Failed to connect to server
org.jinterop.dcom.common.JIException: Access is denied, please check whether the [domain-username-password] are correct. Also, if not already done please check the GETTING STARTED and FAQ sections in readme.htm. They provide information on how to correctly configure the Windows machine for DCOM access, so as to avoid such exceptions.  [0x00000005]
at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:654)
at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:561)
at org.jinterop.dcom.core.JIComServer.<init>(JIComServer.java:524)
at org.openscada.opc.lib.da.Server.connect(Server.java:108)
at Main.main(Main.java:46)
Caused by: rpc.FaultException: Received fault. (unknown)
at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:147)
at rpc.Stub.call(Stub.java:134)
at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:649)
... 4 more
958 [main] INFO org.openscada.opc.lib.da.Server - Destroying DCOM session...
958 [main] INFO org.openscada.opc.lib.da.Server - Destroying DCOM session... forked
960 [OPCSessionDestructor] INFO org.jinterop.dcom.core.JISession - About to destroy 0 sessesion which are linked to this session: 1277142807
960 [OPCSessionDestructor] INFO org.jinterop.dcom.core.JIComOxidRuntime - destroySessionOIDs for session: 1277142807
960 [OPCSessionDestructor] INFO org.openscada.opc.lib.da.Server - Destructed DCOM session
960 [OPCSessionDestructor] INFO org.openscada.opc.lib.da.Server - Session destruction took 2 ms
00000005: Unknown error (00000005)

Solution

  • Problem was solved by explicitly using the comuter ip address as the host instead of "localhost".