2 Replies Latest reply on Feb 3, 2005 12:35 PM by Bruce Perr

    access Queue with JNDI from outside the app server

    Bruce Perr Newbie

      Hello,

      I am accessing a JMS Queue that is bound to the Global JNDI namespace under "jms/epdqueue." I don't have a problem getting the Queue object from components running within JBoss. My code has to be able to access the queue from outside the JVM/app server. I get the InitialContext okay but the lookup returns a javax.naming.Reference object instead of the Queue.What are the steps to get the actual Queue object from the Reference? Here's how the test code sets everything up:

      Properties props = System.getProperties();
      props.put("java.naming.factory.initial",
      "org.jnp.interfaces.NamingContextFactory");

      props.put("java.naming.provider.url", "jnp://localhost:1099");

      props.put("java.naming.factory.url.pkgs",
      "org.jboss.naming:org.jnp.interfaces");

      System.setProperties(props);

      try {

      namingCtx = new InitialContext();

      Object tmp = namingCtx.lookup("jms/epdqueue");

      if (tmp instanceof javax.naming.Reference) {
      Reference ref = (Reference) tmp;
      System.out.println(ref.getClassName());
      System.out.println(ref.getFactoryClassName());
      }
      //etc...

      How can I return the javax.jms.Queue from the lookup instead?

      Thanks,

      Bruce