#20 win7 localhost JIComServer.init () bug

open
nobody
None
5
2012-11-29
2012-01-31
Martin Appl
No

I came across this exeption:

org.jinterop.dcom.common.JIException: An internal error occurred. [0x8001FFFF]
at org.jinterop.dcom.core.JIRemUnknownServer.call(JIRemUnknownServer.java:158)
at org.jinterop.dcom.core.JIRemUnknownServer.addRef_ReleaseRef(JIRemUnknownServer.java:181)
at org.jinterop.dcom.core.JISession.addRef_ReleaseRef(JISession.java:782)
at org.jinterop.dcom.core.JIComObjectImpl.addRef(JIComObjectImpl.java:119)
at org.jinterop.dcom.core.JIComServer.createInstance(JIComServer.java:844)
at org.openscada.opc.lib.list.ServerList.<init>(ServerList.java:61)
at cz.appl.proofOfConcept.OpcInterface.findServer(OpcInterface.java:56)
at cz.appl.proofOfConcept.OpcInterface.connectServer(OpcInterface.java:44)
at cz.appl.proofOfConcept.MainWindow$1.widgetSelected(MainWindow.java:54)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at cz.appl.proofOfConcept.MainWindow.main(MainWindow.java:116)
Caused by: java.net.SocketException: Address family not supported by protocol family: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at org.jinterop.dcom.transport.JIComTransport.attach(JIComTransport.java:185)
at rpc.Stub.attach(Stub.java:106)
at org.jinterop.dcom.core.JIRemUnknownServer.call(JIRemUnknownServer.java:142)

I did some googling and found this should be known issue, at should have been fixed someday during spring, So I used trunk codes and found out issue is still there.
A debug it and found out source of problem lies in JIComServer.java on line 681. Returned bindings does not inlude localhost loop adress 127.0.0.1 but only network adapter adress. But expected target adress is 127.0.0.1. Since network adress does not corespond to 127.0.0.1, we cant pass check on line 681 (binding.getNetworkAddress().substring(0,index).equalsIgnoreCase(targetAddress)) and we fall to next loop which gives us ip6 address which is then put to setAddress. Ip6 address will then cause "Address family not supported by protocol family: connect" exception.

I dont know hot to fix bindings provider, so I just added check for loopback adress and take binding with network adapter adress instead, Dont know if this will be fully operational solution. Please take a look at this issue.

Discussion

  • Martin Appl
    Martin Appl
    2012-01-31

    I forgot..
    Confiruguration JavaSE-1.6, svn rev 136, win7 32b