4 Replies Latest reply on Jul 24, 2002 6:30 AM by Vinodh

    Creation of queues

    Vinodh Newbie

      Hi,
      I am using JBoss 2.4.6 bundled with Tomcat 4.0.3 solely for JMS. I need to create a lot of queues. The problem is that whenever I create a queue in the jboss.jcml file and associate with a JNDI name, it is always bounded under the prefix queue.
      For Ex : if the MBean code is


      then whn I lookup this queue in JNDI i need to use the code as below

      Object ref = initialContext.lookup("queue/Server_Log");

      Can you please tell me how not to bind under the queue context.

        • 1. Re: Creation of queues
          Joel Vogt Master

          hmm, not too sure that would be too good an idea. For what reason do you need the queue to be taken out of the jndi lookup?

          • 2. Re: Creation of queues
            Vinodh Newbie

            I need to move some existing applications into JBoss. It is necessary that there is no chnage required in the JNDI names. Is it possible?

            • 3. Re: Creation of queues
              Noel Hebert Newbie

              Vinodh,

              This is where ejb/resource references really come in
              handy! If you code your EJBs or Servlets to use the
              ENC (Environment Naming Context) by way of java:comp/env
              you can write more portable components that do not care
              where the physical dependencies are.

              At first I really hated moving my JBoss programs to/from
              IBM WebSphere (I use JBoss to prototype quickly). I
              used to "hard-code" my JNDI references in EJBs and
              Servlets to a phyical namespace.After much frustration,
              I finally clicked on to using "logical" ejb/resource
              references reading (and re-reading) the J2EE spec hoping
              there must be some better way then explicit references.

              Instead of making JBoss Queues look like WebSphere Queues
              (or visa-versa), I just have my EJBs or Servlets lookup
              say "java:comp/env/FooQueue" and specify that ENC
              (logical or alias) reference in their J2EE standard
              Deployment Descriptor!

              Then, when I deploy my app to either JBoss or WebSphere
              I map that reference to "queue/BarQueue" or whatever I
              want that reflects the physical resources in the
              deployment environment.

              In JBoss, this means adding things like a jboss.xml or
              jboss-web.xml to an assembled EAR file to associate the
              logical references to physical resources.

              Neat stuff really.

              As much as I hate to say it, read up on ejb/resources
              references in the J2EE 1.2/1.3 spec. It will change
              the way you write, assemble and deploy J2EE applications
              without pulling your hair out, especially if those
              applcations or components move between J2EE application
              servers.

              Cheers,

              Noel.


              • 4. Re: Creation of queues
                Vinodh Newbie

                Noel,
                Thanks a lot for the help. But there are no eJB's that are being used. It is purely JMS. However the logic can be applied to use a property file or Preference API. Thanks again