使用 utgard 读取plc时 出现 org.jinterop.dcom.common.JIException: Access is denied. [0x80070005]

1 篇文章 0 订阅
1 篇文章 0 订阅

在使用utgard通过opcservice读取plc数据时有些opcservice(kingIoservice) 会出现如下错误:

Caused by: org.jinterop.dcom.common.JIRuntimeException: Access is denied.  [0x80070005]
	at org.jinterop.dcom.core.JICallBuilder.readResult(JICallBuilder.java:1077)
	at org.jinterop.dcom.core.JICallBuilder.read(JICallBuilder.java:957)
	at ndr.NdrObject.decode(NdrObject.java:19)
	at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:138)
	at rpc.Stub.call(Stub.java:112)
	at org.jinterop.dcom.core.JIComServer.call(JIComServer.java:870)
	... 6 common frames omitted

解决办法如下:

修改utgard的源码 server.java

 原本的代码如下

 if (this.connectionInformation.getClsid() != null) {
                    this.session = JISession.createSession(this.connectionInformation.getDomain(), this.connectionInformation.getUser(), this.connectionInformation.getPassword());
                    this.session.setGlobalSocketTimeout(socketTimeout);
                    this.comServer = new JIComServer(JIClsid.valueOf(this.connectionInformation.getClsid()), this.connectionInformation.getHost(), this.session);
                } else {
                    if (this.connectionInformation.getProgId() == null) {
                        throw new IllegalArgumentException("Neither clsid nor progid is valid!");
                    }

                    this.session = JISession.createSession(this.connectionInformation.getDomain(), this.connectionInformation.getUser(), this.connectionInformation.getPassword());
                    this.session.setGlobalSocketTimeout(socketTimeout);
                    this.comServer = new JIComServer(JIProgId.valueOf(this.connectionInformation.getProgId()), this.connectionInformation.getHost(), this.session);
                }

修改是只要加上

this.session.useSessionSecurity(true);

修改的代码如下

if ( this.connectionInformation.getClsid () != null )
            {
                this.session = JISession.createSession ( this.connectionInformation.getDomain (), this.connectionInformation.getUser (), this.connectionInformation.getPassword () );
                this.session.setGlobalSocketTimeout ( socketTimeout );
                this.session.useSessionSecurity(true);
                this.comServer = new JIComServer ( JIClsid.valueOf ( this.connectionInformation.getClsid () ), this.connectionInformation.getHost (), this.session );
            }
            else if ( this.connectionInformation.getProgId () != null )
            {
                this.session = JISession.createSession ( this.connectionInformation.getDomain (), this.connectionInformation.getUser (), this.connectionInformation.getPassword () );
                this.session.setGlobalSocketTimeout ( socketTimeout );
                this.session.useSessionSecurity(true);
                this.comServer = new JIComServer ( JIProgId.valueOf ( this.connectionInformation.getProgId () ), this.connectionInformation.getHost (), this.session );
            }

 

Utgard: OpenSCADA 项目底下有两个子项目,分别是 Utgard-Core 和 Utgard-Plungins。Utgard 是 OpenSCADA 的一部分,提供了与 OPC(开放式过程控制)技术相关的功能。 Utgard-Core 是 Utgard 的核心子项目,提供了与 OPC 技术交互的基本功能。它实现了 OPC 数据传输的核心逻辑,包括与 OPC 服务器建立连接、读取和写入数据等。Utgard-Core 具有灵活的架构,可以与不同类型的 OPC 服务器进行通信,并支持多种不同的 OPC 协议。它提供了简洁而易用的 API,使开发者能够方便地在应用程序中集成 OPC 功能。Utgard-Core 在 OpenSCADA 项目中起到了重要的中间层作用,将 OPC 技术与应用程序进行了解耦,提供了一种统一的接口。 Utgard-Plungins 是 Utgard 的插件子项目,它为 Utgard-Core 提供了额外的功能扩展。Utgard-Plungins 包含了一些特定的插件,用于与特定的 OPC 服务器进行通信或处理特定类型的 OPC 数据。这些插件可以根据需要进行选择和集成,以满足不同应用场景的需求。Utgard-Plungins 为开发者提供了更多的灵活性和可扩展性,使他们能够根据项目的具体需求选择和定制插件,实现更加定制化的 OPC 功能。 总体而言,Utgard: OpenSCADA 项目底下的子项目 Utgard-Core 和 Utgard-Plungins 是为了实现与 OPC 技术相关的功能而提供的。Utgard-Core 是核心的部分,提供了与 OPC 服务器的基本交互功能,而 Utgard-Plungins 则提供了额外的插件扩展,增加了更多的功能选择和定制化的能力。通过使用 Utgard: OpenSCADA 项目,开发者可以更方便地集成和使用 OPC 技术,实现各种自动化控制和监控应用。
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值