Hang up on connect to Solaris using GUI app

Help
Anonymous
2010-05-11
2013-05-20

  • Anonymous
    2010-05-11

    Hello. I'm trying to connect from my Windows XP box to Solaris server. It connects without problem when my application is console one. But when I create an app with GUI and copy exactly the same code from console app it can't pass through "ssh.connect(host, new IgnoreHostKeyVerification());". It works fine when I try to connect to FreeBSD server. Here is the code:

    private static final String host = "192.168.56.102";
        private static final String password = "pass";
        private static final String username = "const";

        public static void test() throws Exception {
            SshClient ssh = null;

            try {
                ssh = new SshClient();
                ssh.connect(host, new IgnoreHostKeyVerification());
                }
            } finally {
                if (ssh != null) {
                    ssh.disconnect();
                }
            }

    And here is the log:

    12.05.2010 0:10:50 com.sshtools.j2ssh.transport.cipher.SshCipherFactory <clinit>
    INFO: Loading supported cipher algorithms
    12.05.2010 0:10:51 com.sshtools.j2ssh.transport.kex.SshKeyExchangeFactory <clinit>
    INFO: Loading key exchange methods
    12.05.2010 0:10:51 com.sshtools.j2ssh.configuration.ConfigurationLoader initialize
    INFO: JAVA version is 1.6.0_18
    12.05.2010 0:10:51 com.sshtools.j2ssh.configuration.ConfigurationLoader initialize
    INFO: Extension D:\Developing\java\jdk\jre\lib\ext\dnsns.jar being added to classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.util.ExtensionClassLoader add
    INFO: Adding D:\Developing\java\jdk\jre\lib\ext\dnsns.jar to the extension classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.configuration.ConfigurationLoader initialize
    INFO: Extension D:\Developing\java\jdk\jre\lib\ext\localedata.jar being added to classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.util.ExtensionClassLoader add
    INFO: Adding D:\Developing\java\jdk\jre\lib\ext\localedata.jar to the extension classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.configuration.ConfigurationLoader initialize
    INFO: Extension D:\Developing\java\jdk\jre\lib\ext\sunjce_provider.jar being added to classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.util.ExtensionClassLoader add
    INFO: Adding D:\Developing\java\jdk\jre\lib\ext\sunjce_provider.jar to the extension classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.configuration.ConfigurationLoader initialize
    INFO: Extension D:\Developing\java\jdk\jre\lib\ext\sunmscapi.jar being added to classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.util.ExtensionClassLoader add
    INFO: Adding D:\Developing\java\jdk\jre\lib\ext\sunmscapi.jar to the extension classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.configuration.ConfigurationLoader initialize
    INFO: Extension D:\Developing\java\jdk\jre\lib\ext\sunpkcs11.jar being added to classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.util.ExtensionClassLoader add
    INFO: Adding D:\Developing\java\jdk\jre\lib\ext\sunpkcs11.jar to the extension classpath
    12.05.2010 0:10:51 com.sshtools.j2ssh.transport.publickey.SshKeyPairFactory <clinit>
    INFO: Loading public key algorithms
    12.05.2010 0:10:51 com.sshtools.j2ssh.transport.compression.SshCompressionFactory <clinit>
    INFO: Loading compression methods
    12.05.2010 0:10:51 com.sshtools.j2ssh.transport.hmac.SshHmacFactory <clinit>
    INFO: Loading message authentication methods

    Can anyone help me with it? And by the way how can I enable debug logs to see more details?

     
  • Pat
    Pat
    2010-05-11

    What is the exception you're getting?

     

  • Anonymous
    2010-05-12

    I don't get any. It just hangs on this step.

     

  • Anonymous
    2010-05-12

    Some more details. I've set up Solaris on VirtualBox and it's connected without problems. At work (where I actually get this trouble) servers are located in different subnet. My IP is 10.50.30.20 and server IP is 10.50.3.87. It hangs after "INFO: Loading message authentication methods" message if I use an application with GUI interface (IDE NetBeans, Swing in my case). And it connects fine if I build my app as console app with exactly the same code.

     

  • Anonymous
    2010-05-12

    Looks like I've came to problem as close as possible :) This code hangs my application:

    Socket s = new Socket( "hostname", 22 );

    And I don't know why. As I mentioned it hangs only when Swing is used. I know it isn't related with ssh-tools itself but anyway… any suggestions? :)

     

  • Anonymous
    2010-05-12

    And here is the answer :)

    http://en.wikipedia.org/wiki/SwingWorker

    Sorry for bother you guys :)

     

  • Anonymous
    2010-05-12

    And one more to add :) Actualy running time-consuming tasks in another thread is a good practice but the problem wasn't there (it was still hanging but in another thread :D ). The problem was a proxy. JVM uses browser settings and tries to resolve host names via proxy. I dunno why it stucked in swing app but it did. On one forum I've found some comments about it and this code

    System.setProperty("java.net.useSystemProxies", "false");

    I've added it and… ta-da-da-dam!… it's worked like a charm :) Thanks for attention :)