Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 5556 invoked from network); 8 Aug 2008 10:39:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Aug 2008 10:39:52 -0000 Received: (qmail 1503 invoked by uid 500); 8 Aug 2008 10:39:48 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 1470 invoked by uid 500); 8 Aug 2008 10:39:47 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 1458 invoked by uid 99); 8 Aug 2008 10:39:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 03:39:47 -0700 X-ASF-Spam-Status: No, hits=3.7 required=10.0 tests=DNS_FROM_OPENWHOIS,FORGED_HOTMAIL_RCVD2,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 10:38:50 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KRPNO-0001QP-0w for user@geronimo.apache.org; Fri, 08 Aug 2008 03:39:18 -0700 Message-ID: <18889658.post@talk.nabble.com> Date: Fri, 8 Aug 2008 03:39:18 -0700 (PDT) From: zm To: user@geronimo.apache.org Subject: Re: JMS config and use under geronimo In-Reply-To: <18875397.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: zzzz_mmmm@hotmail.com References: <18875397.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org I have a bit difficulty in understanding: jms/mycon javax.jms.QueueConnectionFactory Container Shareable jms/myqueue javax.jms.Queue Consumes MyQueue Now the "resource-ref" defines a jndi resource on the J2EE platform. But what about the "message-destination-ref"? When should I use "Consumes"/"Produces"? Should I create 2 entries, one for when I post, and another when a retrieve a message? Is that it? (noob question really lol) What about the "message-destination-link" what value should it have? Must it match some value around? Because I don't use it for message posting ... for that I use "java:comp/env/jms/myqueue" as defined in "message-destination-ref-name" (this is the physical name right?) ? Thanks zm wrote: > > Hi, > > I'm looking forward to put a simple web application to work with JMS > messaging, but I can't seem to do it. > > I have not much experience doing it, so I'm getting a bit frustrated. > > First of all, my Java code that sends a message: > > > String message = "Text Message to Send!"; > Connection connection = null; > Session session = null; > > try { > Context ctx = new InitialContext(); > ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup( > "java:comp/env/jms/mycon" ); > Queue myQueue = (Queue) ctx.lookup( "java:comp/env/jms/myqueue" ); > > connection = connectionFactory.createConnection(); > > session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); > > MessageProducer producer = session.createProducer(myQueue); > > Message jmsMessage = session.createTextMessage( message ); > > producer.send( jmsMessage ); > > } catch(Throwable t) { > throw new Exception("Error found!", t); > } finally { > try { > if(session!=null) session.commit(); > } catch(Throwable t) { > } > try { > if(connection!=null) connection.close(); > } catch(Throwable t) { > } > } > > > In the web.xml: > > > > jms/mycon > javax.jms.QueueConnectionFactory > Container > Shareable > > > jms/myqueue > javax.jms.Queue > Consumes > MyQueue > > > > Now to configure the Geronimo, I created selecting "for ActiveMQ" option > under the "JMS Resources", entered data that gave me the following deploy > plan: > > > > xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2"> > > console.jms > mytest > 1.0 > rar > > > > org.apache.geronimo.configs > activemq-broker > car > > > > > > mytest > xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"> > DefaultWorkManager > > > > > > javax.jms.QueueConnectionFactory > > jms/mycon > > > > > > > > > > > > > > javax.jms.Queue > > org.apache.activemq.command.ActiveMQQueue > > > jms/myqueue > name="PhysicalName">jms/myqueue > > > > javax.jms.Topic > > org.apache.activemq.command.ActiveMQTopic > > > > > In the "JMS Resources" list, I now have: > > mytest (console.jms/mytest/1.0/rar) > Type Name Deployed As State Actions > Connection Factory jms/mycon Server-wide running > Queue jms/myqueue Server-wide running > > ( One question at this point, how can I delete a "JMS Resource Groups" > entry like the one I created? ) > > > Running, I receive the following exception: > > Caused by: javax.naming.NotContextException: jms/mycon > at > org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContex > t.java:167) > at > org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContex > t.java:603) > at javax.naming.InitialContext.lookup(InitialContext.java:351) > at > com.megasis.utils.jms.LoggingFacade.postMessage(LoggingFacade.java:17 > 6) > ... 21 more > > > I'm missing something, probably, and I can't find any good tutorials on > how to setup JMS without using MDB ... > > Any help appreciated. > > Thanks > -- View this message in context: http://www.nabble.com/JMS-config-and-use-under-geronimo-tp18875397s134p18889658.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.