What libraries to include with sshj?

965 views
Skip to first unread message

Sugan Krishnan

unread,
Jul 11, 2012, 7:35:57 AM7/11/12
to sshj-...@googlegroups.com
Hi,

I am trying to run the sample programs bundled with the library.

I get this error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/openssl/EncryptionException
at net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile$Factory.create(OpenSSHKeyFile.java:46)
at net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile$Factory.create(OpenSSHKeyFile.java:41)
at net.schmizz.sshj.common.Factory$Named$Util.create(Factory.java:74)
at net.schmizz.sshj.SSHClient.loadKeys(SSHClient.java:479)
at net.schmizz.sshj.SSHClient.loadKeys(SSHClient.java:438)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:349)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:283)
at in.rgksugan.test.Demo.main(Demo.java:24)

I am not sure which bouncy castle jar to include. There are a lot of them available here http://www.bouncycastle.org/latest_releases.html
Can someone pls help me in this. 

Regards,

Jeroen van Erp

unread,
Jul 11, 2012, 7:45:29 AM7/11/12
to sshj-...@googlegroups.com
Hi Sugan

Use the bcprov-<jdk-version>-147.jar

Regards,
Jeroen

Sugan G

unread,
Jul 11, 2012, 8:11:50 AM7/11/12
to sshj-...@googlegroups.com
Hi Jeroen,

Thanks for looking into this.

I am using bcprov-jdk15on-147.jar and still getting the error. This time a different exception.

Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/openssl/PasswordFinder

at net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile$Factory.create(OpenSSHKeyFile.java:46)
at net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile$Factory.create(OpenSSHKeyFile.java:41)
at net.schmizz.sshj.common.Factory$Named$Util.create(Factory.java:74)
at net.schmizz.sshj.SSHClient.loadKeys(SSHClient.java:479)
at net.schmizz.sshj.SSHClient.loadKeys(SSHClient.java:438)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:349)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:283)
at in.rgksugan.test.Demo.main(Demo.java:24)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.openssl.PasswordFinder
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 8 more

Thanks
--
Thanks & Regards,
Sugan

Jeroen van Erp

unread,
Jul 11, 2012, 8:14:43 AM7/11/12
to sshj-...@googlegroups.com
As that is an openssl bouncycastle class my best guess is to also include bcpkix-<jdkversion>-147.jar ;-)

Regards,
Jeroen

Sugan G

unread,
Jul 11, 2012, 8:37:08 AM7/11/12
to sshj-...@googlegroups.com
Thanks Jeroen,

It works.
Reply all
Reply to author
Forward
0 new messages