@kohsuke
I can manually telnet into the windows ec2 instance. However, Jenkins cannot seem to add it as a slave. I see the following error in the winrm logger
Request:
POST http://xxx.xxx.xx.xx:5985/wsman
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns
="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"><env:Header><a:To>http://xxx.xxx.xx.xx:5985/wsman</a:To><a:ReplyTo><a:Address mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:MaxEnvelopeSize mustUnderstand="true">153600</w:MaxEnvelopeSize><a:MessageID>uuid:AC60C672-A7F9-4283-B161-17B5A37A9F63</a:MessageID><w:Locale mustUnderstand="false" xml:lang="en-US"/><p:DataLocale mustUnderstand="false" xml:lang="en-US"/><w:OperationTimeout>PT60S</w:OperationTimeout><a:Action mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><w:ResourceURI mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI><w:OptionSet><w:Option Name="WINRS_NOPROFILE">FALSE</w:Option><w:Option Name="WINRS_CODEPAGE">437</w:Option></w:OptionSet></env:Header><env:Body><rsp:Shell><rsp:InputStreams>stdin</rsp:InputStreams><rsp:OutputStreams>stdout stderr</rsp:OutputStreams></rsp:Shell></env:Body></env:Envelope>
Dec 05, 2014 8:46:40 PM SEVERE hudson.plugins.ec2.win.winrm.WinRMClient sendRequest
I/O Exception in HTTP POST
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at hudson.plugins.ec2.win.winrm.WinRMClient.sendRequest(WinRMClient.java:244)
at hudson.plugins.ec2.win.winrm.WinRMClient.sendRequest(WinRMClient.java:215)
at hudson.plugins.ec2.win.winrm.WinRMClient.openShell(WinRMClient.java:94)
at hudson.plugins.ec2.win.winrm.WinRM.ping(WinRM.java:29)
at hudson.plugins.ec2.win.WinConnection.ping(WinConnection.java:117)
at hudson.plugins.ec2.win.EC2WindowsLauncher.connectToWinRM(EC2WindowsLauncher.java:118)
at hudson.plugins.ec2.win.EC2WindowsLauncher.launch(EC2WindowsLauncher.java:29)
at hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:101)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:241)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I did what Tomasz suggested
2) In WinRMClient.buildHTTPClient() I've removed unregister for AuthPolicy.SPNEGO and added unregister for KERBEROS, DIGEST and NTLM. Before this change there was exception about unsupported auth method, but it was getting lost somewhere in the code flow.
private DefaultHttpClient buildHTTPClient()
{
DefaultHttpClient httpclient = new DefaultHttpClient();
//httpclient.getAuthSchemes().unregister(AuthPolicy.SPNEGO);
httpclient.getAuthSchemes().unregister(AuthPolicy.KERBEROS);
httpclient.getAuthSchemes().unregister(AuthPolicy.DIGEST);
httpclient.getAuthSchemes().unregister(AuthPolicy.NTLM);