当前位置: 代码迷 >> 综合 >> java链接opc报异常org.jinterop.dcom.common.JIException: Access is denied解决
  详细解决方案

java链接opc报异常org.jinterop.dcom.common.JIException: Access is denied解决

热度:38   发布时间:2024-02-07 08:05:39.0

记录一下这次从发现问题到解决问题的过程
项目是通过java链接OPC,读取数据,并且发送数据的
程序一直运行正常,最近客户反馈说无法读取数据,通过查看,发现访问异常了。花了2天的时间才解决了这个异常。

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:542)at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:458)at org.jinterop.dcom.core.JIComServer.<init>(JIComServer.java:427)at org.openscada.opc.lib.da.Server.connect(Server.java:118)at opc.apply.threads.ReadDataThread.getServer(ReadDataThread.java:231)at opc.apply.threads.ReadDataThread.run(ReadDataThread.java:57)at java.lang.Thread.run(Thread.java:745)
Caused by: rpc.FaultException: Received fault. (unknown)at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:142)at rpc.Stub.call(Stub.java:112)at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:538)... 6 more

通过看异常日志,发现是访问被拒绝了,百度查看资料,尝试了以下几种方案:
1、修改注册表https://blog.csdn.net/yigerendengqingtian/article/details/84710809
2、添加一段代码

this.session.useSessionSecurity(true);

https://blog.csdn.net/hzf1993/article/details/81188538
3、配置DCOM
https://www.softwaretoolbox.com/dcom/html/configuring__opcenum1.html
4、查看windows日志,找问题
查看windows安全日志,确认问题
通过查看日志,发现是帐户登录失败,具体分析是密码错误,尝试重新设置密码,解决了(其实密码并没有改变,但是不知道为什么会提示密码错误)

  相关解决方案