当前位置:网站首页>Utgard connection opcserver reported an error caused by: org jinterop. dcom. common. JIRuntimeException: Access is denied. [0x800
Utgard connection opcserver reported an error caused by: org jinterop. dcom. common. JIRuntimeException: Access is denied. [0x800
2022-04-23 03:15:00 【GeXueliu】
- My device
win10 pro 、kepserver. Prepare to use utgard Compiling opc Client and opcserver Running on the same laptop . therefore dcom You don't need to configure it ? - My configuration
I only in 【 The computer 】 A new user is created under the option :OpcServer password :123456. Other security policies 、 The firewall is not set ( Because it can't be set , my 【 Service components 】 Next 【 My computer 】 There is a red arrow on the , Right click No 【 attribute 】, So that's it , The reference is This blog ) - kepserver
- Code
It uses utgard library
package com.test;
import org.jinterop.dcom.common.JIException;
import org.jinterop.dcom.core.JIString;
import org.jinterop.dcom.core.JIVariant;
import org.junit.Test;
import org.openscada.opc.lib.common.AlreadyConnectedException;
import org.openscada.opc.lib.common.ConnectionInformation;
import org.openscada.opc.lib.common.NotConnectedException;
import org.openscada.opc.lib.da.*;
import java.net.UnknownHostException;
import java.util.concurrent.Executors;
public class ConnectOpc2 {
final ConnectionInformation ci = new ConnectionInformation();
@Test
public void connect() throws AlreadyConnectedException, JIException, UnknownHostException, NotConnectedException, DuplicateGroupException, InterruptedException, AddFailedException {
ci.setHost("127.0.0.1");
ci.setDomain("");
ci.setUser("OPCServer");
ci.setPassword("123456");
ci.setClsid("7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729");// See the first picture
// {7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729}
// {FF9F1A4B-E79A-43E6-B79E-166F5ACC2944}
// {5C905440-FD5D-4610-A532-D9C8CE4A0393}
// {467DE023-58B0-4A96-8C5C-AAC1AFD6C51D}
String itemId = " passageway 2. equipment 1.TAG2";// See the second picture
final Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
try {
// connect to server
server.connect();
// add sync access, poll every 500 ms
final AccessBase access = new SyncAccess(server, 500);
access.addItem(itemId, (item, state) ->
System.out.println("Resut: " + state.toString()));
// start reading
access.bind();
// wait a little bit
Thread.sleep(10 * 1000);
// stop reading
access.unbind();
} catch (final JIException e) {
System.out.println(String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
e.printStackTrace();
}
}
// final AccessBase access = new SyncAccess(server, 500);
//
// access.addItem(itemId, new DataCallback() {
// @Override
// public void changed(Item item, ItemState itemState) {
// int type = 0;
// try {
// type = itemState.getValue().getType(); // The type is actually a number , Defined with constants
// } catch (JIException e) {
// e.printStackTrace();
// }
// System.out.println(" The data type of the monitoring item is :-----" + type);
// System.out.println(" The timestamp of the monitoring item is :-----" + itemState.getTimestamp().getTime());
// System.out.println(" The details of the monitoring item are :-----" + itemState);
//
// // If you read yes short Type value
// if (type == JIVariant.VT_I2) {
// short n = 0;
// try {
// n = itemState.getValue().getObjectAsShort();
// } catch (JIException e) {
// e.printStackTrace();
// }
// System.out.println("-----short Type values : " + n);
// }
//
// // If you read a value of string type
// if (type == JIVariant.VT_BSTR) { // The type of string is 8
// JIString value = null;
// try {
// value = itemState.getValue().getObjectAsString();
// } catch (JIException e) {
// e.printStackTrace();
// } // Read by string
// String str = value.getString(); // Get a string
// System.out.println("-----String Type values : " + str);
// }
// }
// });
// // start reading, Start reading values
// access.bind();
// // wait a little bit, There is one 10 Second delay
// Thread.sleep(10 * 1000);
// // stop reading, Stop reading
// access.unbind();
}
5. result
6. The first reference is the technology brother's blog , It's very clear . But I can't keep up , Because of my 【 Component service 】 Under tabs 【 My computer 】 It looks like this , It's different from his .
Finally I saw someone say ,opc server and opc The client runs on the same computer , No configuration required dcom Then I don't know , It should be ok .
Hope to have utgard Connect opc server Big brother of experience , Guide . If you know Kingview as opcserver Better
版权声明
本文为[GeXueliu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220627323269.html
边栏推荐
- 研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台
- 手机连接电脑后,QT的QDIR怎么读取手机文件路径
- Drawing polygons with < polygon / > circular array in SVG tag
- 为什么BI对企业这么重要?
- C syntax pattern matching [switch expression]
- 由于3²+4²=5²,所以称‘3,4,5‘为勾股数,求n(包括n)以内所有勾股数数组。
- It can receive multiple data type parameters - variable parameters
- 搭建XAMPP时mysql端口被占用
- Maui initial experience: Cool
- A comprehensive understanding of static code analysis
猜你喜欢
PID debugging of coding motor (speed loop | position loop | follow)
ASP. Net 6 middleware series - conditional Middleware
Fiddler use
Comprehensive calculation of employee information
Xutils3 corrected a bug I reported. Happy
可以接收多种数据类型参数——可变参数
研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台
12.<tag-链表和常考点综合>-lt.234-回文链表
Ide-idea-problem
Charles uses three ways to modify requests and responses
随机推荐
2022a special equipment related management (elevator) work license question bank and simulation examination
【VS Code】解决jupyter文件在vs code中显示异常的问题
队列的存储和循环队列
数据挖掘系列(3)_Excel的数据挖掘插件_估计分析
可以接收多种数据类型参数——可变参数
PID debugging of coding motor (speed loop | position loop | follow)
Charles uses three ways to modify requests and responses
It can receive multiple data type parameters - variable parameters
Xamarin effect Chapter 22 recording effect
2022 P cylinder filling training test questions and simulation test
If the deep replication of objects is realized through C #?
全网最全,接口自动化测试怎么做的?精通接口自动化测试详解
Use split to solve the "most common words" problem
《C语言程序设计》(谭浩强第五版) 第7章 用函数实现模块化程序设计 习题解析与答案
Top ten project management software similar to JIRA
Course design of Database Principle -- material distribution management system
Configuration table and page information automatically generate curd operation page
This new feature of C 11, I would like to call it the strongest!
Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
Peut recevoir plusieurs paramètres de type de données - paramètres variables