majeed said - 2016-12-15

Hi,
when i try to connect to remote windows machine using i-interop i got the following exception:

java.lang.ArrayIndexOutOfBoundsException: 16
at jcifs.util.Encdec.dec_uint32le(Encdec.java:90)
at ndr.NdrBuffer.dec_ndr_long(NdrBuffer.java:146)
at ndr.NetworkDataRepresentation.readUnsignedLong(NetworkDataRepresentation.java:64)
at org.jinterop.dcom.core.JIRemoteSCMActivator$RemoteCreateInstance.read(JIRemoteSCMActivator.java:642)
at ndr.NdrObject.decode(NdrObject.java:36)
at rpc.ConnectionOrientedEndpoint.call(ConnectionOrientedEndpoint.java:137)
at rpc.Stub.call(Stub.java:113)
at org.jinterop.dcom.core.JIComServer.init(JIComServer.java:645)
at org.jinterop.dcom.core.JIComServer.initialise(JIComServer.java:496)
at org.jinterop.dcom.core.JIComServer.<init>(JIComServer.java:429)
at test.PerformanceMonitor.setWindowsCredentials(PerformanceMonitor.java:72)
at test.PerformanceMonitor.main(PerformanceMonitor.java:789)

my code:
dcomSession = init(domain, username, password);
        comServer = new JIComServer(valueOf("WbemScripting.SWbemLocator"), hostname, dcomSession);
        IJIDispatch wbemLocator = (IJIDispatch) narrowObject(comServer.createInstance().queryInterface(IID));

        params = new Object[] { new JIString(hostname), new JIString("ROOT\\CIMV2"), JIVariant.OPTIONAL_PARAM(),
                JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), JIVariant.OPTIONAL_PARAM(), new Integer(0),
                JIVariant.OPTIONAL_PARAM() };
        JIVariant results[] = wbemLocator.callMethodA("ConnectServer", params);
        wbemServices = (IJIDispatch) narrowObject(results[0].getObjectAsComObject());

please adivse what im doing wrong?

Regards,