B4J Library SSHJ - ssh, scp, sftp for Java

JackKirk

Well-Known Member
Licensed User
Longtime User
Plase help me!
My project run in debug mode good, but release mode run with error:

net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1]

I am way out of my depth here but have been using this library with success in a different context.

Just an observation - your problem seems to be similar to:
https://www.b4x.com/android/forum/threads/sshj-ssh-scp-sftp-for-java.88615/page-3#post-619235
(post 47 above)

Reading through subsequent posts it looks like the problem was solved at post 54 - although you might choke on using really old code.
 

Gandalf

Member
Licensed User
Longtime User
Just in case someone is annoyed by these errors:
B4X:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
This can be solved by downloading appropriate SLF4J version, extracting file slf4j-nop-1.7.25.jar to your Additional Libraries folder and putting
B4X:
#AdditionalJar: slf4j-nop-1.7.25.jar
into Region Project Attributes.
 

JackKirk

Well-Known Member
Licensed User
Longtime User
Last edited:

roerGarcia

Active Member
Licensed User
Longtime User
Sure


In this image, why the name of the object sftp (small caps) is not the same of the event SFTPUploadFinished (capitals) ?

is there any difference? What event should it be called? Is it coded? (Google Translated from spanish)
 

mindful

Active Member
Licensed User
If you initialize SSHJ without an event name (.Initialize("")) then you need to use WaitFor as you can see in the photo.

If you initialize SSHJ with an event name (.Initialize("ssh")) then when ftp upload is finished the SFTPUploadFinished event will be called (you need to have a sub named ssh_SFTPUploadFinished) ... type Public Sub -> Space -> a tooltip appears with the text "Press tab to insert event declaration" -> tab -> Now a list appears -> Find SSHJSFTPClient -> enter -> and a list of events appear -> choose what you need !
 

roerGarcia

Active Member
Licensed User
Longtime User
Thanks a lot!!!
Finally, this thing works as expected (in my mind ...)

I learned something today.

PD. and.... why the sub ssh SFTP Upload finished
does not seem to be executed ?
 
Last edited:

FrancescoS

Member
Licensed User
Longtime User
Hi mindful, great work, thanks !
Where can I find the list of all events that are handled if I use the 'Initialize ("ssh")' mode?
Thanks
 

tufanv

Expert
Licensed User
Longtime User
what is the event name for connection closed or lost? I see someone using Sub ssh_ConnectionLost (Reason As String) in one of the messages but it is not working here.
 

DonManfred

Expert
Licensed User
Longtime User
I see someone using Sub ssh_ConnectionLost (Reason As String) in one of the messages but it is not working here.
There is no such event in this library. Check the xml. All available Events are listed there.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…