cloudsoft / winrm4j

Apache License 2.0
94 stars 53 forks source link

NoSuchMethodError PoolingNHttpClientConnectionManager.validatePendingRequests() #103

Open zerikv opened 5 years ago

zerikv commented 5 years ago

At runtime I got the following error:

Exception in thread "CXFCloseIdleConnectionThread" java.lang.NoSuchMethodError: org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.validatePendingRequests()V
    at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduitFactory$CloseIdleConnectionThread.run(AsyncHTTPConduitFactory.java:416)

winrm4j depends on CXF 3.2.8. since the commit https://github.com/cloudsoft/winrm4j/commit/9b2620ade60391493b296a03afcf59d3733f51e2 [SECURITY] Bump cxf from 3.2.7 to 3.2.8

CXF 3.2.8 depends on httpasyncclient 4.1.4 (see https://github.com/apache/cxf/blob/cxf-3.2.8/parent/pom.xml) which include the missing method validatePendingRequests :

CXF 3.2.8 depends also on httpcore-nio 4.4.9 instead of 4.4.4 for winrm4j, I have read the comments in the pom about dependencyConvergence failed but for me the "mvn clean install" works fine after upgraded httpasyncclient to 4.1.4.

zerikv commented 5 years ago

please see PR https://github.com/cloudsoft/winrm4j/pull/104

zerikv commented 5 years ago

At last I also meet the error "Plugin execution not covered by lifecycle configuration" in eclipse "2018-09" (4.9.0) with m2e plugin 1.9.1.

To remove these errors I applied the following:

After that several m2e connectors have been installed. That seems better than the other option "Permanently mark goal run in pom.xml as ignored in Eclipse build" which works also but mess a bit the POM files.

It stayed one error again wih the plugin "cxf-java2ws-plugin" for which no connector has been found. For this I applied the other Quick-Fix "Permanently mark goal run in pom.xml as ignored in Eclipse build". Then I changed the action from <ignore/> to <execute/> in order to generate the classes of the web-service client. btw the version of this plugin has been modified because is owned a different version from its of CXF.

Finally I finished by the usual: "Project > Maven > Update project ..." and "Project > Clean" and no more errors are displayed.

techdinesh commented 5 years ago

Requirement : I want to execute a .bat file in a Remote windows machine using java program Hi Team, I am not able to execute this below snippet of code successfully within the java program after updated this jar httpasyncclient 4.1.2 to httpasyncclient 4.1.4 & my program got stuck and getting error message 'Could not receive Message'.
Can you please help me on this issue advance thanks.

` WinRmClientContext context = WinRmClientContext.newInstance();

WinRmTool tool = WinRmTool.Builder.builder("XXXX.xxxx.com", "xxxx", "****")
    .authenticationScheme(AuthSchemes.NTLM)
    .port(5986)
    .useHttps(false)
    .context(context)
    .build();
     tool.executeCommand("c:\\1.bat");

// tool.executePs("echo hi"); context.shutdown(); `

Error Message : ` WARNING: Interceptor for {http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}WinRmService#{http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}Create has thrown exception, unwinding now

org.apache.cxf.interceptor.Fault: Could not receive Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:65) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140) at com.sun.proxy.$Proxy46.create(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at io.cloudsoft.winrm4j.client.RetryingProxyHandler.invokeWithRetry(RetryingProxyHandler.java:44) at io.cloudsoft.winrm4j.client.RetryingProxyHandler.invoke(RetryingProxyHandler.java:34) at com.sun.proxy.$Proxy47.create(Unknown Source) at io.cloudsoft.winrm4j.client.WinRmClient.createShell(WinRmClient.java:344) at io.cloudsoft.winrm4j.winrm.WinRmTool.executeCommand(WinRmTool.java:282) at com.paychex.test.WinRm.main(WinRm.java:22) Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://XXXX.xxx.com:5986/wsman: 120,000 milliseconds timeout on connection http-outgoing-0 [ACTIVE] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1402) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386) at org.apache.cxf.transport.http.asyncclient.AsyncHTTPConduit$AsyncWrappedOutputStream.close(AsyncHTTPConduit.java:417) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) ... 18 more ` ==============================================

Questions : What would be the protocol in below error message within a java program want to execute a windows command in Remote machine ?

Exception in thread "main" java.lang.IllegalArgumentException: java.net.MalformedURLException: no protocol: //10.6.x.xx at io.cloudsoft.winrm4j.client.WinRmClientBuilder.toUrlUnchecked(WinRmClientBuilder.java:180) at io.cloudsoft.winrm4j.client.WinRmClientBuilder.<init>(WinRmClientBuilder.java:40) at io.cloudsoft.winrm4j.client.WinRmClient.builder(WinRmClient.java:95) at io.cloudsoft.winrm4j.client.CliClient.main(CliClient.java:18) Caused by: java.net.MalformedURLException: no protocol: //10.6.x.xx at java.net.URL.<init>(URL.java:593) at java.net.URL.<init>(URL.java:490) at java.net.URL.<init>(URL.java:439) at io.cloudsoft.winrm4j.client.WinRmClientBuilder.toUrlUnchecked(WinRmClientBuilder.java:178) ... 3 more