Hi,

can you use jconsole to see what queues do you have and does the queue
contains the message?

Cheers
--
Dejan Bosanac

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Sat, Aug 29, 2009 at 7:28 PM, moonbird <moonb...@ymail.com> wrote:

>
> Hi,
> could it be, that i can not lookup destinations which are in the global
> jndi
> namespace of jboss ?
> i used activemq embedded in jboss5 via JCA with a ressource adapter.
> ...stationInfoQueue = (Queue) ctx.lookup("stationInfoQueue"); doesnt get
> null - but it also doenst work (the consument on the other side doenst get
> anything from the queue)
>
> this is a jndi list from the jboss administration web console:
> +- stationInfoQueue (class: org.apache.activemq.command.ActiveMQQueue)
>
> some posting threads ago, i had a posting about looking up the
> ConnectionFactory which also doesnt work. So i used the
> queueConnectionFactory = new
> ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL); and i
> thought now i can lookup the destinations via jndi...
>
> Thx so far !
>
>  this is my java client code:
> // Look up connection factory and queue(destination)
>                try
>                {
>                        // this seems to be not work - because ActiveMQ is
> embedded in JBoss5 by
> JCA/RA
>                        //queueConnectionFactory = (QueueConnectionFactory)
> ctx.lookup("activemq/QueueConnectionFactory");
>                        queueConnectionFactory = new
> ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
>
>                        stationInfoQueue = (Queue)
> ctx.lookup("stationInfoQueue");
>
>                        if (queueConnectionFactory == null)
>                        {
>                                System.err.println("NULL for
> queueConnectionFactory");
>                                System.exit(1);
>                        }
>
>                        if (stationInfoQueue == null)
>                        {
>                                System.err.println("NULL for
> stationInfoQueue");
>                                System.exit(1);
>                        }
>                }
>                catch (NamingException e)
>                {
>                        System.err.println("JNDI API lookup failed:" + e);
>                        System.exit(1);
>                }
>
>        // Create connection. Create session from connection; false means
>        // session is not transacted. Create requestor and text message.
> Send
>        // messages, wait for answer and finally close session and
> connection.
>                try
>                {
>                        queueConnection =
> queueConnectionFactory.createQueueConnection();
>                        queueSession =
> queueConnection.createQueueSession(false,
> Session.AUTO_ACKNOWLEDGE);
>                        // obviously this is needed ??? why doesnt it work
> to lookup the activemq
> queue via jndi ?
>                        stationInfoQueue =
> queueSession.createQueue("stationInfoQueue");
>                        textMessage =
> queueSession.createTextMessage(myXMLRequestAsString);
>                        // javax.jms.QueueRequestor creates a TemporaryQueue
> for the responses
> and provides a request method that sends the request message
>                        // and waits for its reply.This is a basic
> request/reply abstraction that
> should be sufficient for most uses.
>                        // JMS providers and clients are free to create more
> sophisticated
> versions.
>                        queueRequestor = new QueueRequestor(queueSession,
> stationInfoQueue);
>                        //sends the message and waits until respond is
> received
>                        TextMessage answer = (TextMessage)
> queueRequestor.request(textMessage);
>                        System.out.println("CLIENT: Response message
> received: ");
>                        System.out.println(answer.getText());
>                }
>                catch (JMSException e)
>                {
>                        System.out.println("JMSExceptionn occurred:" + e);
>                }
>                finally
>                {
>                        if (queueConnection != null)
>                        {
>                                // close connections
>                                try
>                                {
>                                        queueSession.close();
>                                        queueConnection.close();
>                                }
>                                catch (JMSException e)
>                                {
>                                        e.printStackTrace();
>                                }
>                        }
>                }
> --
> View this message in context:
> http://www.nabble.com/ActiveMQ-queue---JNDI-lookup-tp25204754p25204754.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Reply via email to