2 Replies Latest reply on Oct 18, 2010 9:24 PM by freezxq zhang

    Connection refused to host: 127.0.0.1;

    freezxq zhang Newbie

      hi:

           when I use my client on windows connect the hornetq server on the same machine,they can communicate,but when I dispatch the honetq server on linux(10.232.36.89),and the client also on windows ,throws the exception.I hava find the same problem in the faq,but I bind the address :10.232.36.89  arch036089.sqa.cm4 in the /etc/hosts file,but it still come up the exception.(I also try to config the client and hornetq server on the different window platfrom,Though the client don`t throws the exception ,there is no result out of the client console)

       

      IN the config of hornetq-bean.xml as follows:

      <bean name="JNDIServer" class="org.jnp.server.Main">
            <property name="namingInfo">
               <inject bean="Naming"/>
            </property>
            <property name="port">9000</property>
            <property name="bindAddress">10.232.36.89</property>
            <property name="rmiPort">11098</property>
            <property name="rmiBindAddress">localhost</property>
         </bean>

       

      throws the exception on client:

       

      Exception in thread "main" javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused: connect]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:839)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at com.taobao.hornetq.HornetqPublish.<init>(HornetqPublish.java:63)
      at com.taobao.hornetq.HornetqPublish.main(HornetqPublish.java:115)
      Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused: connect
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
      ... 4 more
      Caused by: java.net.ConnectException: Connection refused: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(Unknown Source)
      at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
      at java.net.PlainSocketImpl.connect(Unknown Source)
      at java.net.SocksSocketImpl.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at java.net.Socket.connect(Unknown Source)
      at java.net.Socket.<init>(Unknown Source)
      at java.net.Socket.<init>(Unknown Source)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
      ... 10 more

       

      who can help me ? thanks!

        • 1. Re: Connection refused to host: 127.0.0.1;
          Jeff Mesnil Master

          <bean name="JNDIServer" class="org.jnp.server.Main">

                <property name="namingInfo">
                   <inject bean="Naming"/>
                </property>
                <property name="port">9000</property>
                <property name="bindAddress">10.232.36.89</property>
                <property name="rmiPort">11098</property>
                <property name="rmiBindAddress">localhost</property>
             </bean>

          your rmiBindAddress is still bound to localhost. You should change it to 10.232.36.89 too.

          • 2. Re: Connection refused to host: 127.0.0.1;
            freezxq zhang Newbie

            thanks to your help, now I hava rememand the rmiBindAddress to 10.232.36.89,and the config in hornetq-configuration.xml,rememand the address to 10.232.36.89,too. It can run normally. the hornetq-configuration.xml as follows:  

            <connectiors>

                 <connector name="netty">

                 <factory_class>org.hornetq.integration.transportws.netty.NettyConnectorFactory</factory-class>

                 <parm key="host" value="${hornetq.remoting.netty.host:10.232.36.89}"/>

                 <parm key="port" value="${hornetq.remoting.netty.port:5445}"/>

                 </connector>

            <connectiors>