0 Replies Latest reply on Aug 13, 2010 7:09 PM by Ahmad Siddiqi

    JBOSS AS 6 M4 Issue: Can't connect remotely to HornetQ. Please help!!

    Ahmad Siddiqi Newbie

      I installed Jboss AS6 on my local machine and installed it as a windows service. The admin-console comes up fine and I can see everything setup correctly however I can't connect to the Queues via code from a remote computer although it works fine when i use localhost as my url. Following is the error that i'm getting

       

      Error: javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.217.1:5445 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1690)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1761)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at HelloJms.runExample(HelloJms.java:51)
      at HelloJms.main(HelloJms.java:29)
      Caused by: java.net.SocketTimeoutException: Receive timed out
      at java.net.PlainDatagramSocketImpl.receive0(Native Method)
      at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
      at java.net.DatagramSocket.receive(DatagramSocket.java:725)
      at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1659)

       

      After reviewing various blogs I realized that AS6 sets everything up for you by itself. For example it sets up the NettyConnectors and NettyAcceptors by default and uses port 5445 as the default. Even though I attached the hornetq-configuration.xml with the post I want to show a partial view of the hornetq-configuration.xml I have for connectors and acceptors.

      <connectors>       <connector name="netty">          <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>          <param key="host"  value="${jboss.bind.address:localhost}"/>            <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>       </connector> </connectors>

       

      <acceptors>         <acceptor name="netty">          <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>          <param key="host"  value="${jboss.bind.address:localhost}"/>            <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>       </acceptor> </acceptors>

       

      My client is extremely simple and all im doing in the client is loading my properties, specifying the url and port and trying to get a queue as follows.

       

       

      {code}

      Connection connection = null; InitialContext initialContext = null;      

      TransportConfiguration config = new TransportConfiguration(); Properties props = new Properties();

      // I've tried all sorts of urls here

      props.put(Context.PROVIDER_URL, "jnp://192.168.217.1:1099");

      props.put(Context.PROVIDER_URL, "jnp://192.168.217.1:5445");

      props.put(Context.PROVIDER_URL, "jnp://192.168.217.1:5445");

      props.put(Context.PROVIDER_URL, "jnp://ahmads-pc3:5445");

      props.put(Context.PROVIDER_URL, "jnp://ahmads-pc3.saccap.int:1099"); // fullname.

      props.put(Context.PROVIDER_URL, "jnp://ahmads-pc3.saccap.int:5445"); // fullname.

      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); props.put(Context.URL_PKG_PREFIXES, "java.naming.factory.url.pkgs"); initialContext = new InitialContext(props); ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");

      {code}