com.jcraft.jsch.JSchException: connection is closed by foreign host


Samebug tips

Ant scp task has an attribute called trust. If set to false (default) the host you connect to has to be set in the knownhosts file (you might have to create it) Another way is to explicitly set "trust = true". Check the documentation: https://goo.gl/G5680x


5 months ago
Expert tip

Solutions on the web

Solution icon of stackoverflow
connection is closed by foreign host

Solution icon of web
via wordpress.com by Unknown author, 1 year ago
connection is closed by foreign host

Solution icon of coderanch
connection is closed by foreign host

Solution icon of github
connection is closed by foreign host

Solution icon of stackoverflow
connection is closed by foreign host

Solution icon of web
via mulesoft.com by Unknown author, 1 year ago
connection is closed by foreign host

Solution icon of github
via GitHub by ibuenros
, 1 year ago
connection is closed by foreign host

Solution icon of googlegroups
via Google Groups by Sadok Ben Yahia, 4 months ago
connection is closed by foreign host

Solution icon of sourceforge
connection is closed by foreign host

Stack trace

com.jcraft.jsch.JSchException: connection is closed by foreign host
	at com.jcraft.jsch.Session.connect(Session.java:269)
	at client.JschClient.sendFile(JschClient.java:29)
	at client.JschClient.main(JschClient.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
98 more bugmates