java.net.ConnectException: Connection refused: connect

Atlassian JIRA | Sultan Maiyaki [Atlassian] | 4 years ago
  1. 0

    *Steps to reproduce* # Create a job with a task of type SSH that could run SSH commands on a remote server. # Choose the authentication type to either *Key without passphrase* OR *key with passphrase* # Enter a command such as "mkdir /home/smaiyaki/hello" # Run the build and it will fail with the following error in the build logs. {noformat} Failed to connect to host net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:114) at net.schmizz.sshj.SSHClient.auth(SSHClient.java:205) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:305) at com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:82) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111) at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52) at java.lang.Thread.run(Thread.java:722) Caused by: net.schmizz.sshj.userauth.UserAuthException: publickey auth failed at net.schmizz.sshj.userauth.UserAuthImpl.handle(UserAuthImpl.java:157) at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:474) at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127) at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195) at net.schmizz.sshj.transport.Reader.run(Reader.java:72) {noformat} The following appears in the server logs: {noformat} 2013-01-30 22:11:45,417 INFO [qtp35496097-123] [AccessLogFilter] sultan GET http://localhost:1044/bamboo44/ajax/viewPlanUpdates.action?sinceSystemTime=0&lastProject= 158047kb 2013-01-30 22:11:45,532 DEBUG [qtp35496097-123] [AccessLogFilter] END: sultan GET http://localhost:1044/bamboo44/ajax/viewPlanUpdates.action?sinceSystemTime=0&lastProject= 158047kb-68706kb 115ms 2013-01-30 22:11:50,056 ERROR [7-BAM::Default Agent::Agent:pool-16-thread-1] [Promise] <<authenticated>> woke to: net.schmizz.sshj.userauth.UserAuthException: publickey auth failed 2013-01-30 22:11:50,056 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [UserAuthImpl] `publickey` auth failed 2013-01-30 22:11:50,062 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [ExecuteBuildTask] TESTA-SCP-JOB1-12: Running post build plugin 'NCover Results Collector' 2013-01-30 22:11:50,092 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [NCoverBuildProcessor] inside NCoverBuildProcessor.call() {noformat} This issue is replicable even with the default SSH port of 22. Changing the authentication type to password works fine. *Edits* The password authentication also fails if the SSH port is not the default 22 with the error message below thrown in the build logs: {noformat} Failed to connect to host java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) 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.PlainSocketImpl.connect(PlainSocketImpl.java:157) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) at java.net.Socket.connect(Socket.java:579) at net.schmizz.sshj.SocketClient.connect(SocketClient.java:70) at net.schmizz.sshj.SocketClient.connect(SocketClient.java:77) at net.schmizz.sshj.SocketClient.connect(SocketClient.java:103) at com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:74) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111) at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52) at java.lang.Thread.run(Thread.java:722) {noformat}

    Atlassian JIRA | 4 years ago | Sultan Maiyaki [Atlassian]
    java.net.ConnectException: Connection refused: connect
  2. 0

    *Steps to reproduce* # Create a job with a task of type SSH that could run SSH commands on a remote server. # Choose the authentication type to either *Key without passphrase* OR *key with passphrase* # Enter a command such as "mkdir /home/smaiyaki/hello" # Run the build and it will fail with the following error in the build logs. {noformat} Failed to connect to host net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:114) at net.schmizz.sshj.SSHClient.auth(SSHClient.java:205) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:305) at com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:82) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111) at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52) at java.lang.Thread.run(Thread.java:722) Caused by: net.schmizz.sshj.userauth.UserAuthException: publickey auth failed at net.schmizz.sshj.userauth.UserAuthImpl.handle(UserAuthImpl.java:157) at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:474) at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127) at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195) at net.schmizz.sshj.transport.Reader.run(Reader.java:72) {noformat} The following appears in the server logs: {noformat} 2013-01-30 22:11:45,417 INFO [qtp35496097-123] [AccessLogFilter] sultan GET http://localhost:1044/bamboo44/ajax/viewPlanUpdates.action?sinceSystemTime=0&lastProject= 158047kb 2013-01-30 22:11:45,532 DEBUG [qtp35496097-123] [AccessLogFilter] END: sultan GET http://localhost:1044/bamboo44/ajax/viewPlanUpdates.action?sinceSystemTime=0&lastProject= 158047kb-68706kb 115ms 2013-01-30 22:11:50,056 ERROR [7-BAM::Default Agent::Agent:pool-16-thread-1] [Promise] <<authenticated>> woke to: net.schmizz.sshj.userauth.UserAuthException: publickey auth failed 2013-01-30 22:11:50,056 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [UserAuthImpl] `publickey` auth failed 2013-01-30 22:11:50,062 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [ExecuteBuildTask] TESTA-SCP-JOB1-12: Running post build plugin 'NCover Results Collector' 2013-01-30 22:11:50,092 INFO [7-BAM::Default Agent::Agent:pool-16-thread-1] [NCoverBuildProcessor] inside NCoverBuildProcessor.call() {noformat} This issue is replicable even with the default SSH port of 22. Changing the authentication type to password works fine. *Edits* The password authentication also fails if the SSH port is not the default 22 with the error message below thrown in the build logs: {noformat} Failed to connect to host java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69) 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.PlainSocketImpl.connect(PlainSocketImpl.java:157) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) at java.net.Socket.connect(Socket.java:579) at net.schmizz.sshj.SocketClient.connect(SocketClient.java:70) at net.schmizz.sshj.SocketClient.connect(SocketClient.java:77) at net.schmizz.sshj.SocketClient.connect(SocketClient.java:103) at com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:74) at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187) at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93) at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206) at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103) at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111) at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52) at java.lang.Thread.run(Thread.java:722) {noformat}

    Atlassian JIRA | 4 years ago | Sultan Maiyaki [Atlassian]
    java.net.ConnectException: Connection refused: connect
  3. 0

    sshj Exec.java throws not connected error

    Stack Overflow | 1 year ago | fatihonurIRL
    java.net.ConnectException: Connection refused: connect
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    SCPDownload.java example fails to run properly

    GitHub | 5 years ago | tshepang
    java.net.ConnectException: Connection refused
  6. 0

    ForgeRock OpenIG Sample (WordPressLogin.json) not working

    Stack Overflow | 3 years ago | songjing
    java.net.ConnectException: Connection refused: connect

  1. treefolk 1 times, last 1 week ago
  2. kjhdofjosvs 20 times, last 2 weeks ago
  3. Andreas Häber 9 times, last 2 weeks ago
  4. Aria Pahlavan 2 times, last 2 weeks ago
  5. stigkj 10 times, last 2 weeks ago
44 more registered users
51 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.net.ConnectException

    Connection refused: connect

    at java.net.DualStackPlainSocketImpl.connect0()
  2. Java RT
    Socket.connect
    1. java.net.DualStackPlainSocketImpl.connect0(Native Method)
    2. java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:69)
    3. java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    4. java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    5. java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    6. java.net.PlainSocketImpl.connect(PlainSocketImpl.java:157)
    7. java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
    8. java.net.Socket.connect(Socket.java:579)
    8 frames
  3. sshj
    SocketClient.connect
    1. net.schmizz.sshj.SocketClient.connect(SocketClient.java:70)
    2. net.schmizz.sshj.SocketClient.connect(SocketClient.java:77)
    3. net.schmizz.sshj.SocketClient.connect(SocketClient.java:103)
    3 frames
  4. com.atlassian.bamboo
    NamedThreadFactory$2.run
    1. com.atlassian.bamboo.plugins.scp.SshTask.execute(SshTask.java:74)
    2. com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:187)
    3. com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:93)
    4. com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
    5. com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
    6. com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
    7. com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
    8. com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
    8 frames
  5. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:722)
    1 frame