0

I had written a program to execute powershell command from Java using winrm4j api. I am able to execute the command. The problem is after executing command, program is not terminating until i press Control C. If i am not doing it, i get the below exception after some time.I am looking for inputs to resolve this issue.Thanks in Advance.

2016-12-20T23:03:35.086 DEBUG [org.apache.http.impl.nio.client.InternalIODispatch] - http-outgoing-1 [ACTIVE] Exception
java.io.IOException: Connection reset by peer
        at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:197)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
        at org.apache.http.nio.reactor.ssl.SSLIOSession.receiveEncryptedData(SSLIOSession.java:449)
        at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:503)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:122)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:164)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:339)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:317)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:278)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:106)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:590)
        at java.lang.Thread.run(Thread.java:745)
2016-12-20T23:03:35.092 DEBUG [org.apache.http.impl.nio.conn.ManagedNHttpClientConnectionImpl] - http-outgoing-1 x.x.x.x:37869<->x.x.x.x:5986[ACTIVE][r:r][ACTIVE][r][NOT_HANDSHAKING][0][0][0][0]: Shutdown
2016-12-20T23:03:35.094 DEBUG [org.apache.http.impl.nio.client.InternalIODispatch] - http-outgoing-1 [CLOSED]: Disconnected
Mike Garuccio
  • 2,588
  • 1
  • 11
  • 20
Arul
  • 143
  • 3
  • 12

1 Answers1

0

That's now fixed in PR#43. Once merged a new version will be released with the change. In the mean time you can build your own version from the PR branch.

For a workaround before exiting you can add the following in your app:

BusFactory.getDefaultBus().shutdown(true);
Svet
  • 196
  • 1
  • 6