Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 89901 invoked from network); 17 Aug 2007 15:41:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Aug 2007 15:41:28 -0000 Received: (qmail 53534 invoked by uid 500); 17 Aug 2007 15:41:24 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 53509 invoked by uid 500); 17 Aug 2007 15:41:24 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 53500 invoked by uid 99); 17 Aug 2007 15:41:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Aug 2007 08:41:24 -0700 X-ASF-Spam-Status: No, hits=-3.8 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sukoneru@cisco.com designates 171.68.10.86 as permitted sender) Received: from [171.68.10.86] (HELO sj-iport-4.cisco.com) (171.68.10.86) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Aug 2007 15:41:16 +0000 Received: from sj-dkim-2.cisco.com ([171.71.179.186]) by sj-iport-4.cisco.com with ESMTP; 17 Aug 2007 08:40:54 -0700 X-IronPort-AV: i="4.19,275,1183359600"; d="scan'208"; a="8516019:sNHT43148376" Received: from sj-core-5.cisco.com (sj-core-5.cisco.com [171.71.177.238]) by sj-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id l7HFesr8029923; Fri, 17 Aug 2007 08:40:54 -0700 Received: from xbh-sjc-231.amer.cisco.com (xbh-sjc-231.cisco.com [128.107.191.100]) by sj-core-5.cisco.com (8.12.10/8.12.6) with ESMTP id l7HFesiF003222; Fri, 17 Aug 2007 15:40:54 GMT Received: from xmb-sjc-21a.amer.cisco.com ([171.70.151.152]) by xbh-sjc-231.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 17 Aug 2007 08:40:54 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Error on starting QueueConnection Date: Fri, 17 Aug 2007 08:40:53 -0700 Message-ID: <5BD9FA70F5EDAC43AB816A5FDE30F6AC04EA0379@xmb-sjc-21a.amer.cisco.com> In-Reply-To: <20070817105803.GSFA5.86101.root@fepweb16> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Error on starting QueueConnection Thread-Index: Acfg3wPlai2Dd8DxTqOotQw69F72EAABZFvw References: <5BD9FA70F5EDAC43AB816A5FDE30F6AC04EA00CC@xmb-sjc-21a.amer.cisco.com> <20070817105803.GSFA5.86101.root@fepweb16> From: "Suchitha Koneru \(sukoneru\)" To: "Dave Carlson" Cc: X-OriginalArrivalTime: 17 Aug 2007 15:40:54.0515 (UTC) FILETIME=[FF625C30:01C7E0E4] DKIM-Signature: v=0.5; a=rsa-sha256; q=dns/txt; l=9791; t=1187365254; x=1188229254; c=relaxed/simple; s=sjdkim2002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=sukoneru@cisco.com; z=From:=20=22Suchitha=20Koneru=20\(sukoneru\)=22=20 |Subject:=20RE=3A=20Error=20on=20starting=20QueueConnection |Sender:=20; bh=o5maHFtfHFaYUlQeD9YquZziMk1lYVPCA21yCQBNyCY=; b=1pWKn5+h5FUcbP4TKDnblRW7o/8VCvkpAsEllhgaT0iY9X6m3BaQKoq0LlcoTqLC8wDoioOo +U3xmKcmc6PggJ3t5+9j+789FteJ97XS2ab7NOCm+Rd55VbzOlCYmJSu; Authentication-Results: sj-dkim-2; header.From=sukoneru@cisco.com; dkim=pass ( sig from cisco.com/sjdkim2002 verified; ); X-Virus-Checked: Checked by ClamAV on apache.org The JMS documentation suggests that we start the connection after creating the receiver and registering it with a message listener. Please look at point no: 6 in the section "Client to Consume Messages" http://java.sun.com/developer/technicalArticles/Ecommerce/jms/index.html =20 -----Original Message----- From: Dave Carlson [mailto:gshpsrule@charter.net]=20 Sent: Friday, August 17, 2007 7:58 AM To: users@activemq.apache.org Cc: Suchitha Koneru (sukoneru) Subject: RE: Error on starting QueueConnection Are you sure about the ordering? It seems odd that you would want to start the flow of messages across the connection before you have created a receiver. Looking at ActiveMQ example code in ConsumerTool, they are creating the receiver first... ActiveMQConnectionFactory connectionFactory =3D new ActiveMQConnectionFactory(user, password, url); Connection connection =3D connectionFactory.createConnection(); if (durable && clientId !=3D null && clientId.length()>0 && !"null".equals(clientId) ) { connection.setClientID(clientId); } connection.setExceptionListener(this); connection.start(); session =3D connection.createSession(transacted, ackMode); if (topic) { destination =3D session.createTopic(subject); } else { destination =3D session.createQueue(subject); } replyProducer =3D session.createProducer(null); =09 replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); MessageConsumer consumer =3D null; if (durable && topic) { consumer =3D session.createDurableSubscriber((Topic) destination, consumerName); } else { consumer =3D session.createConsumer(destination); } ---- "Suchitha Koneru (sukoneru)" wrote:=20 > Start the queue connection after creating the receiver . Change the=20 > order and see. It is always recommended that the connection is started > after creating the receiver . The following should be the order. Give=20 > it a try. >=20 > ActiveMQQueueReceiver aqr =3D > (ActiveMQQueueReceiver)qs.createReceiver(q) ;=20 > aqr.setMessageListener(new > BatchReceiverTechnicalService()) ; > aqc.start() ; >=20 > Also I noticed that in the jndi resource for jms/Connectionfactory =20 > you are not using max.Inactivity flag for the broker url. > But while adding connector to the broker you are using this flag,=20 > please use the same broker url through out for consistency. >=20 >=20 > -----Original Message----- > From: denez [mailto:ibouddha@yahoo.fr] > Sent: Thursday, August 16, 2007 7:03 AM > To: users@activemq.apache.org > Subject: Re: Error on starting QueueConnection >=20 >=20 > Do you already have this type of error ? > Do i forget something in my configuration. > I use : > apache-activemq-4.1.1.jar > Tomcat 5.5.23 > jdk1.5.0_07 >=20 > Could you tell me if something is wrong ! > Here is my context declaration in Tomcat : >=20 > workDir=3D"C:\myJMSApp\work" > > name=3D"jms/ConnectionFactory" > auth=3D"Container" > type=3D"org.apache.activemq.ActiveMQConnectionFactory" > description=3D"JMS Connection Factory" > factory=3D"org.apache.activemq.jndi.JNDIReferenceFactory" > brokerURL=3D"tcp://localhost:61616" > brokerName=3D"LocalActiveMQBroker" > useEmbeddedBroker=3D"true"/> >=20 > auth=3D"Container" > type=3D"org.apache.activemq.command.ActiveMQQueue" > factory=3D"org.apache.activemq.jndi.JNDIReferenceFactory" > physicalName=3D"batch"/> > >=20 > Thanks in advance for all reply, help / answer. > Regards, >=20 > Denez >=20 >=20 > denez wrote: > >=20 > > Hi all, > >=20 > > I got the same error trying to create a sender ! > > A very strange thing appear because there is no exception throw !=20 > > Just >=20 > > nothing happened and the rest of my code is never (i suspect) > excecuted. > >=20 > > Could you help me, or ask me if something is not clear. > > Thanks in advance, > > Regards, > >=20 > > Denez > >=20 > >=20 > > denez wrote: > >>=20 > >> I search around to find my error and find that you should use=20 > >> ActiveMQConnection. > >> Now i can start the connection but have a same problem will trying=20 > >> to >=20 > >> createReceiver. > >> See the code below (previous + modification) : > >>=20 > >> public class ActiveMQBrokerStartListener implements=20 > >> ServletContextListener { > >> =09 > >> BrokerService broker =3D new BrokerService(); > >> ActiveMQConnection aqc =3D null ; > >> =09 > >> public void contextInitialized(ServletContextEvent arg0) { > >> try{ > >> =20 > >> > = broker.addConnector("tcp://localhost:61616?trace=3Dtrue&wireFormat.maxIn > ac > tivityDuration=3D-1"); > >> broker.start(); > >> InitialContext ic =3D new InitialContext(); > >> Context ctx =3D (Context) = ic.lookup("java:comp/env"); > >> ActiveMQConnectionFactory acf =3D > >> =20 > >> (ActiveMQConnectionFactory)ctx.lookup("jms/ConnectionFactory"); > >> aqc =3D (ActiveMQConnection)acf.createQueueConnection(); > >> aqc.start() ; > >> ActiveMQQueueSession qs =3D > >> =20 > >> (ActiveMQQueueSession)aqc.createQueueSession(false, > >> Session.CLIENT_ACKNOWLEDGE) ; > >> ActiveMQQueue q =3D > (ActiveMQQueue)ctx.lookup("jms/batch"); > >> ActiveMQQueueReceiver aqr =3D > >> (ActiveMQQueueReceiver)qs.createReceiver(q) ; // ERROR LINE > >> aqr.setMessageListener(new > >> BatchReceiverTechnicalService()) ; > >> }catch(Exception e){ > >> System.err.println(e.getMessage()); > >> e.printStackTrace(); > >> throw new RuntimeException(e); > >> } > >> } > >>=20 > >> public void contextDestroyed(ServletContextEvent arg0) { > >> try{ > >> aqc.close() ; > >> //qc.close() ; > >> broker.stop(); > >> }catch(Exception e){ > >> System.err.println(e.getMessage()); > >> e.printStackTrace(); > >> throw new RuntimeException(e); > >> } > >> } > >> } > >>=20 > >> What is wrong ?? > >> Why i can not create a Receiver ? > >>=20 > >> Thanks in advance > >> Regards, > >> Denez > >>=20 > >>=20 > >>=20 > >>=20 > >> denez wrote: > >>>=20 > >>> Hi all, > >>>=20 > >>> I would like to start a broker and Activate a MessageListener on=20 > >>> startup of my webApp. > >>> I made all the needed configuration to have a > ServletContextListener. > >>> I can debug inside my ServletContextListener implementation named : > >>> ActiveMQBrokerStartListener. > >>> You can see the code of it below : > >>>=20 > >>> public class ActiveMQBrokerStartListener implements=20 > >>> ServletContextListener { > >>> BrokerService broker =3D new BrokerService(); > >>> QueueConnection qc =3D null ; > >>> =09 > >>> public void contextInitialized(ServletContextEvent arg0) { > >>> try{ > >>> =20 > >>> > = broker.addConnector("tcp://localhost:61616?trace=3Dtrue&wireFormat.maxIn > ac > tivityDuration=3D-1"); > >>> broker.start(); > >>> InitialContext ic =3D new InitialContext(); > >>> Context ctx =3D (Context) = ic.lookup("java:comp/env"); > >>> ActiveMQConnectionFactory cf =3D > >>> =20 > >>> ActiveMQConnectionFactory)ctx.lookup("jms/ConnectionFactory"); > >>> qc =3D (QueueConnection) = cf.createQueueConnection(); > >>> qc.start() ; > >>> QueueSession qs =3D qc.createQueueSession(false, > >>> Session.CLIENT_ACKNOWLEDGE) ; > >>> Queue q =3D (Queue)ctx.lookup("jms/batch"); > >>> QueueReceiver qr =3D qs.createReceiver(q) ; > >>> qr.setMessageListener(new Receiver()) ; > >>> }catch(Exception e){ > >>> System.err.println(e.getMessage()); > >>> e.printStackTrace(); > >>> throw new RuntimeException(e); > >>> } > >>> } > >>>=20 > >>> public void contextDestroyed(ServletContextEvent arg0) { > >>> try{ > >>> qc.close() ; > >>> broker.stop(); > >>> }catch(Exception e){ > >>> System.err.println(e.getMessage()); > >>> e.printStackTrace(); > >>> throw new RuntimeException(e); > >>> } > >>> } > >>> } > >>>=20 > >>> I place a breakpoint on the line that should create a QueueSession. > >>> But never enter in it. If i place a breakpoint on the ligne that=20 > >>> createQueueConnection i have it. > >>> So the problem is on the qc.start() ; If i inspect the=20 > >>> QueueConnection i can see that the started=3Dfalse as normal. > >>>=20 > >>> What is wrong on my code ? > >>> Could you help me, or tell me what you think about this ? > >>>=20 > >>> Regards, > >>> Denez > >>>=20 > >>=20 > >>=20 > >=20 > >=20 >=20 > -- > View this message in context: > http://www.nabble.com/Error-on-starting-QueueConnection-tf4278515s2354 > .h > tml#a12182022 > Sent from the ActiveMQ - User mailing list archive at Nabble.com.