1 Reply Latest reply on May 22, 2006 8:08 AM by jaikiran pai

    How to connect to a remote Queue from webapp

    Craig McDaniel Newbie

      I am deploying a WAR file which needs to look up some resources (DataSource) in the local JNDI provider, but also needs to send messages to a Queue hosted on a remote JBoss server (same version).

      I looked at the Wiki page below for setting up an MDB, but I need to know what I must do differently for my webapp.


        • 1. Re: How to connect to a remote Queue from webapp
          jaikiran pai Master

          You need to specify the remoteserver name(or address) in the InitialContext and do a lookup for the remote queue. Something like:

          // create a JNDI context
           Hashtable env = new Hashtable();
           env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
           env.put(Context.PROVIDER_URL, "jnp://remoteserver:1099");
           env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
           Context context = new InitialContext(env);
           // retrieve queue
           Queue queue = (Queue)context.lookup("queue/queueName");