title: Jenkins Slave Agent - Ubuntu: port out range:-1
body: <p>I'm trying to get Jenkins slave agent running in VM. I have Windows and Ubuntu VMs, Windows one running fine. However getting an error when Slave Agent is starting on Ubuntu:</p>
  
  <p>Start command:</p>
  
  <pre><code>java -jar slave.jar -jnlpUrl
  https://SERVER/ci/computer/MACHINE/slave-agent.jnlp -secret XXX
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Skipping HTTPS certificate checks altogether. Note that this is not secure at all.
  Sep 22, 2017 12:57:58 PM hudson.remoting.jnlp.Main createEngine
  INFO: Setting up slave: MACHINE
  Sep 22, 2017 12:57:58 PM hudson.remoting.jnlp.Main$CuiListener &lt;init&gt;
  INFO: Jenkins agent is running in headless mode.
  Sep 22, 2017 12:57:58 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Locating SERVER among [https://SERVER/ci/]
  Sep 22, 2017 12:57:59 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
  INFO: Remoting SERVER accepts the following protocols: [JNLP4-connect, JNLP-connect, Ping, JNLP2-connect]
  Sep 22, 2017 12:57:59 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Agent discovery successful
    Agent address: SERVER
    Agent port:    51967
    Identity:      XXX
  Sep 22, 2017 12:57:59 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Handshaking
  Sep 22, 2017 12:57:59 PM hudson.remoting.jnlp.Main$CuiListener status
  INFO: Connecting to SERVER:51967
  Sep 22, 2017 12:57:59 PM hudson.remoting.jnlp.Main$CuiListener error
  SEVERE: port out of range:-1
  java.lang.IllegalArgumentException: port out of range:-1
      at java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
      at java.net.InetSocketAddress.&lt;init&gt;(InetSocketAddress.java:224)
      at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.getResolvedHttpProxyAddress(JnlpAgentEndpointResolver.java:359)
      at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:193)
      at hudson.remoting.Engine.connect(Engine.java:500)
      at hudson.remoting.Engine.innerRun(Engine.java:364)
      at hudson.remoting.Engine.run(Engine.java:287)
  </code></pre>
  
  <p>the error:</p>
  
  <p><strong>SEVERE: port out of range:-1
  java.lang.IllegalArgumentException: port out of range:-1</strong></p>
  
  <p>any ideas?</p>