Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 54401 invoked from network); 4 Jan 2010 15:26:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jan 2010 15:26:57 -0000 Received: (qmail 63735 invoked by uid 500); 4 Jan 2010 15:26:57 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 63663 invoked by uid 500); 4 Jan 2010 15:26:57 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 63653 invoked by uid 99); 4 Jan 2010 15:26:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jan 2010 15:26:57 +0000 X-ASF-Spam-Status: No, hits=2.9 required=10.0 tests=HTML_MESSAGE,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of ricardo@cflex.com.br does not designate 209.85.223.199 as permitted sender) Received: from [209.85.223.199] (HELO mail-iw0-f199.google.com) (209.85.223.199) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jan 2010 15:26:49 +0000 Received: by iwn37 with SMTP id 37so11903103iwn.30 for ; Mon, 04 Jan 2010 07:26:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.148.83 with SMTP id o19mr818632ibv.39.1262618788328; Mon, 04 Jan 2010 07:26:28 -0800 (PST) From: Ricardo Melo Date: Mon, 4 Jan 2010 13:26:08 -0200 Message-ID: Subject: Issue trying to browse a activemq queue To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0016e644c6285d757c047c5858af X-Virus-Checked: Checked by ClamAV on apache.org --0016e644c6285d757c047c5858af Content-Type: text/plain; charset=ISO-8859-1 Hi, I'm using camel and I need to get the number of elements present in a activemq queue, because the queue has a max size. I'm trying to use QueueBrowser Interface, with no success. The queue I put messages in is called "activemq:queue:out". I've found some code to do that job, but I can't connect to the queue, a javax.naming. NoInitialContextException is thrown at the identified line showed bellow. The connection string is not working. What should I use to connect to the queue created by camel? Here is the code: // get the initial context InitialContext ctx = new InitialContext(); // lookup the queue object [EXCEPTION!] Queue queue = (Queue) ctx.lookup("queue:out"); // lookup the queue connection factory QueueConnectionFactory connFactory = (QueueConnectionFactory) ctx. lookup("queue/connectionFactory"); // create a queue connection QueueConnection queueConn = connFactory.createQueueConnection(); // create a queue session QueueSession queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); // create a queue browser QueueBrowser queueBrowser = queueSession.createBrowser(queue); // start the connection queueConn.start(); Thanks in advance, Ricardo Melo --0016e644c6285d757c047c5858af--