1 Reply Latest reply on Jan 24, 2002 12:51 PM by acruise

    Connecting to a queue/topic on another host?

    acruise

      Hey folks,

      This is probably the second-simplest use case for a JMS service, but I can't figure out how to make it work with JBossMQ.

      I want to connect from a separate host, so I've got all the client jars in the classpath, my PROVIDER_URL is "hostname:1099" and my JNDI_FACTORY is "org.jnp.interfaces.NamingContextFactory".

      Of course everything works fine when the client and server are on the same machine, but when I try to access the queue from another machine, it doesn't work. The relevant part of the stack trace is below.

      I haven't changed anything much from the default JBoss 3.0.0a configuration; just added a user, a queue and a topic, all of which work fine from localhost.

      Any hints?

      Thanks!

      javax.naming.CommunicationException. Root exception is java.rmi.ConnectException: Connect
      ion refused to host: 127.0.0.1; nested exception is:
      java.net.ConnectException: Connection refused
      java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:320)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:133)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:120)
      at java.net.Socket.(Socket.java:273)
      at java.net.Socket.(Socket.java:100)
      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:25)
      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:120)
      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:499)
      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:190)
      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:83)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:365)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)

        • 1. Re: Connecting to a queue/topic on another host?
          acruise

          I figured it out.

          The reason the JBossMQ client libraries were trying to connect to 127.0.0.1 is because that's what RMI thought its hostname was. The reason RMI had this crazy idea is that I'd added the server's hostname to the "localhost" line in /etc/hosts, the RMI server was doing a reverse lookup on the hostname and getting 127.0.0.1, and publishing that in its remote references.

          I added an entry matching the hostname to the real IP address to /etc/hosts and everything worked.