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

Random null pointer exception #570

Closed
pksilen opened this issue Jun 4, 2024 · 3 comments
Closed

Random null pointer exception #570

pksilen opened this issue Jun 4, 2024 · 3 comments

Comments

@pksilen
Copy link

pksilen commented Jun 4, 2024

I experience a null pointer exception randomly. I.e. it does not happen all the time and not in all environments

14:55:15  Caused by: java.lang.NullPointerException
14:55:15    at java.base/java.lang.Class.forName0(Native Method)
14:55:15    at java.base/java.lang.Class.forName(Class.java:375)
14:55:15    at com.jcraft.jsch.Session.receive_kexinit(Session.java:601)

I am using the latest version of JSCH and Java 17.
This started to happen after I added following lines of code:

JSch.setConfig("kex", "curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512");
JSch.setConfig("cipher.s2c", "aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com");
JSch.setConfig("cipher.c2s", "aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com");
JSch.setConfig("mac.s2c", "hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com");
JSch.setConfig("mac.c2s", "hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com");
JSch.setConfig("server_host_key", "ssh-ed25519,rsa-sha2-512,rsa-sha2-256");
JSch.setConfig("PubkeyAcceptedAlgorithms", "ssh-ed25519,rsa-sha2-512,rsa-sha2-256");
@norrisjeremy
Copy link
Contributor

Hi @pksilen,

What is the exact version of JSch for which you received this NPE?
Contrary to what you stated, this could not have occurred with the latest version (0.2.17) because line 601 of Session.java is a blank line.

Thanks,
Jeremy

@norrisjeremy
Copy link
Contributor

Hi @pksilen,

What is the exact version of JSch for which you received this NPE? Contrary to what you stated, this could not have occurred with the latest version (0.2.17) because line 601 of Session.java is a blank line.

Thanks, Jeremy

Btw, I believe that you are in fact using a very old version of JSch that does not actually support the following algorithms:

JSch.setConfig("kex", "curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512");

@pksilen
Copy link
Author

pksilen commented Jun 7, 2024

Hi,
Thanks for the feedback. I noticed that there is also another version (0.1.55) of JSCH in my classpath. It is probably coming as a transitive dependency from another library. I need to fix that. I will close this ticket.

@pksilen pksilen closed this as completed Jun 7, 2024
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