JSchException:Algorithm negotiation fail

abnormal:

  

com.jcraft.jsch.JSchException:Algorithm negotiation fail
	at com.jcraft.jsch.Session.receive_kexinit(Session.java:590) ~[jsch-0.1.54.jar:na]
	at com.jcraft.jsch.Session.connect(Session.java:320) ~[jsch-0.1.54.jar:na]
	at com.jcraft.jsch.Session.connect(Session.java:183) ~[jsch-0.1.54.jar:na]

Procedure: Connect to SFTP Server 

Environment: linux redhat7.1, jdk1.7, jsch0.1.54

 

Cause of the exception: The encryption algorithm of the SFTP server does not match the local one, and there is no corresponding local encryption algorithm.

 

Solution:

   Install the JCE package for java:

      JCE (Java Cryptography Extension) is a set of packages that provide frameworks and implementations for encryption, key generation and negotiation, and Message Authentication Code (MAC) algorithms.

 

  JCE package download address corresponding to JDK1.7:

http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

  JCE package download address corresponding to JDK1.8:

http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html

 

  After downloading, get a zip package, decompress it, and get two jar packages, local_policy.jar and US_export_policy.jar. 

  These two jar files are placed under %JDK_HOME%\jre\lib\security.

  Restart the program, the exception is resolved. 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326614078&siteId=291194637