Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "Key exchange was not finished, connection is closed" exception #140

Open
bndeshpande opened this issue Oct 5, 2023 · 4 comments

Comments

@bndeshpande
Copy link

Hi Team,
Recently upgraded our application from Java 8 to Java 17. And we have compiled the JNC and ganymed module as well. But when will bringup our springboot application will call device connect but we are seeing below exception:

This was not there when application running in Java8. Can any one help on this.

[main] Key exchange was not finished, connection is closed.
java.io.IOException: Key exchange was not finished, connection is closed.
at ch.ethz.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:75) ~[ganymed-ssh2-262.jar!/:262]
at ch.ethz.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:169) ~[ganymed-ssh2-262.jar!/:262]
at ch.ethz.ssh2.Connection.connect(Connection.java:759) ~[ganymed-ssh2-262.jar!/:262]
at com.tailf.jnc.SSHConnection.(Unknown Source) ~[jnc-1.0.jar!/:?]
at com.tailf.jnc.Device.connect(Unknown Source) ~[jnc-1.0.jar!/:?]
at com.tailf.jnc.Device.connect(Unknown Source) ~[jnc-1.0.jar!/:?]

@martin-volf
Copy link
Contributor

I'm not sure we can help you, this is an old version of the JNC client, the Ganymed SSH library is unsupported, again, can you migrate to a newer version?

@bndeshpande
Copy link
Author

bndeshpande commented Oct 6, 2023

Thanks for info. We are using maven project so please check below new JNC gradle info converted to pom.xml to support maven based. Is this file is fine or anything needs to be added?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.tailf</groupId>
  <artifactId>jnc</artifactId>
  <version>1.2</version>
  <packaging>jar</packaging>

  <name>JNC</name>
  <description>JNC (Java NETCONF Client) is the name of a Java library for communicating with NETCONF agents. This version includes Mavenir changes for supporting NETCONF call home - RFC 8051. Also sets soTimeout for Device connections</description>
  <url>https://github.com/tail-f-systems/JNC</url>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://apache.org/licenses/LICENSE-2.0</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <organization>Tail-f Systems</organization>
      <organizationUrl>http://www.tail-f.com/</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:[email protected]:tail-f-systems/JNC.git</connection>
    <developerConnection>scm:git:[email protected]:tail-f-systems/JNC.git</developerConnection>
    <url>[email protected]:tail-f-systems/JNC.git</url>
  </scm>

	<build>
		<!-- Specify maven non-standard source folder -->
		<sourceDirectory>src</sourceDirectory>		
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

  <dependencies>
    <dependency>
      <groupId>com.hierynomus</groupId>
      <artifactId>sshj</artifactId>
      <version>0.33.0</version>
    </dependency>
	<dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.2.11</version>
    </dependency>
	<dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcprov-jdk15on</artifactId>
      <version>1.70</version>
    </dependency>
  </dependencies> 

</project>

@martin-volf
Copy link
Contributor

This appears to be a POM file for building the JNC library, I would not expect you need that; I believe the "only" thing you need to do is to add a link to our Maven repository and JNC dependency declaration to your project's POM file.

@martin-volf
Copy link
Contributor

martin-volf commented Oct 7, 2023

For the sake of completeness, you need to have something like this in your POM (or POMs):

  <repositories>
    <repository>
      <id>jncrepo</id>
      <name>jnc github repo</name>
      <url>https://gitlab.com/api/v4/groups/57822468/-/packages/maven</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.tailf.jnc</groupId>
      <artifactId>JNC</artifactId>
      <version>1.1.0</version>
    </dependency>
  </dependencies>

That alone does not deal with generating Java classes from YANG modules using the pyang plugin, I assume you already have that somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants