获取opc Server 列表的时候报错
代码如下
public static void main(String[] args) throws Exception {
ServerList serverList = new ServerList("127.0.0.1","Administrator", "fy19941228","127.0.0.1");
Collection<ClassDetails> classDetails = serverList
.listServersWithDetails(new Category[] {
Categories.OPCDAServer10, Categories.OPCDAServer20,
Categories.OPCDAServer30 }, new Category[] {});
for (ClassDetails cds : classDetails) {
System.out.println(cds.getProgId() + "=" + cds.getDescription());
}
}
报错:
五月 25, 2018 9:46:09 上午 org.jinterop.dcom.core.JIComServer initialise
警告: Got the class not registered exception , will attempt setting entries based on status flags...
Exception in thread "main" org.jinterop.dcom.common.JIException:Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154]
at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:550)
at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:458)
at org.jinterop.dcom.core.JIComServer.(JIComServer.java:427)
at org.openscada.opc.lib.list.ServerList.(ServerList.java:60)
at org.openscada.opc.lib.list.ServerList.(ServerList.java:90)
at com.freud.opc.utgard.cases.OPCTest1.main(OPCTest1.java:28)
Caused by: org.jinterop.dcom.common.JIRuntimeException: Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154]
at org.jinterop.dcom.core.JIRemActivation.read(JIRemActivation.java:191)
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.init(JIComServer.java:538)
... 5 more
五月 25, 2018 9:46:09 上午 org.jinterop.dcom.core.JISession postDestroy
信息: About to destroy links for Session: 810216272 , size of which is 0