Sorry... I actually do have a connect() in there. I cut it out with some other code which was removed for the list. I eventually overcame the problem by using the following:

Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking","no");

session.setConfig(config);

I am still not sure why it was failing... but this appears to have fixed my issue.

thanks.




On Apr 16, 2010 10:21am, Atsuhiko Yamanaka <[email protected]> wrote:
Hi,



+-From: [email protected] -----------

|_Date: Fri, 16 Apr 2010 13:17:57 +0000 __

|

|I recently upgraded to the latest version of Jsch and we are having a

|problem. Can someone please explain to me why my HostKey would come

|back as null?



|Jsch jsch = new Jsch();

|jsch.setKnownHosts("c:\my_hosts");

|Session session = jsch.getSession("USER","sftp.mydomain.com",22);

|HostKey hk = session.getHostKey();

|if(hk == null){

|//we have a problem

|}



That method is expected to be invoked after the success of

Session#connect()





Sincerely,

--

Atsuhiko Yamanaka

JCraft,Inc.

1-14-20 HONCHO AOBA-KU,

SENDAI, MIYAGI 980-0014 Japan.

Tel +81-22-723-2150

+1-415-578-3454

Skype callto://jcraft/

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to