Version 3

    Connection refused to host:


    When attempting to use JMS or RMI remotely, you might run across an exception that looks like this:


        javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host:


    After you have correctly set your client to use a remote host, either by creating a in your classpath that looks like:




    Or, by explicitly setting properties for your InitialContext in code:


        import java.util.Properties;
        Properties properties = new Properties ();
        properties.put(Context.PROVIDER_URL, "jnp://YOUR-SERVER:1099");
        Context context = new InitialContext(properties);


    This is the result of a problem in the JBoss server side configuration. You're successfully talking to the correct server, but it does not know its own hostname or IP address.


    -b option for run.bat/ enables us to tell JBoss the host it is running on. That solves this problem.


    Eg. run.bat -b192.168.9.6 -Djboss.bind.address=


    (the 2nd parameter makes jboss server accessible from remote clients)