1 Reply Latest reply on Jan 14, 2005 5:07 PM by Jing Yang

    how to lookup Queue in SessionBean

    Jing Yang Newbie

      I am failed to lookup Queue in EJB container.
      The code as below:
      InitialContext ctx = new InitialContext();
      try{
      obj = ctx.lookup("queue/testQueue");
      }
      catch(Exception e){
      System.out.println("" +e)
      }
      But I can lookup jndi EJB AND queue/testQueue is listed in JMX console as
      globle jndi namepace.

      How to lookup Queue in SessinBean ?

        • 1. Re: how to lookup Queue in SessionBean
          Jing Yang Newbie

          I added the code in ejb-jar.xml


          <resource-ref>
          <res-ref-name>jms/PointToPoint</res-ref-name>
          <res-type>javax.jms.QueueConnectionFactory</res-type>
          <res-auth>Container</res-auth>
          </resource-ref>

          <resource-env-ref>
          <resource-env-ref-name>queue/testQueue</resource-env-ref-name>
          <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
          </resource-env-ref>


          Object obj=ctx.lookup("queue/testQueue")
          Still failed to lookup Queue.