Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Process Manager (Stardust) » Send activemq message to CarnotApplicationQuque
Send activemq message to CarnotApplicationQuque [message #990535] Wed, 12 December 2012 23:10 Go to next message
Rahim Kanjiyani is currently offline Rahim Kanjiyani
Messages: 16
Registered: October 2012
Junior Member
Hi, I am trying to send message to CarnotApplicationQuque using following code.

Hashtable props = new Hashtable();
props.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.put("java.naming.provider.url", "tcp://bulldog:2057");
Context messaging = new InitialContext(props);
QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) messaging.lookup("java:comp/env/jms/CarnotXAConnectionFactory");
Queue queue = (Queue) messaging.lookup("java:comp/env/jms/CarnotApplicationQueue");
QueueConnection queueConnection = queueConnectionFactory.createQueueConnection();
queueConnection.start();
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = queueSession.createSender(queue);
TextMessage message = queueSession.createTextMessage();
message.setText("Hello World");
sender.send(message);

I am getting following error message. Any idea?

012-12-12 16:10:00.104|Info| |main|Main|Initializing message consumer...
javax.naming.NameNotFoundException: CarnotXAConnectionFactory
at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:235)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ca.uleth.jms.Main.main(Main.java:81)
Re: Send activemq message to CarnotApplicationQuque [message #990629 is a reply to message #990535] Thu, 13 December 2012 14:01 Go to previous message
Jan Hendrik Scheufen is currently offline Jan Hendrik Scheufen
Messages: 61
Registered: October 2011
Member

Hi Rahim,

it's likely that the name for the JNDI lookup is wrong and you should double-check under what name the connection factory is available.
This depends on your deployment. Since you're using ActiveMQ, my guess is you have a Spring WAR deployment and you should find the Stardust Spring context files that assemble and publish the connection factory. Also check your context.xml and web.xml if there are resource-ref entries that expose the connection factory under a different name.

In case you're deploying your code within the same WAR as the Stardust engine, the simplest thing would be to wrap your code into a Spring bean and inject a reference to the connection factory bean directly. This would eliminate the need for a JNDI lookup. (That is assuming you are using a Spring-based deployment).

Best regards,

Jan
Previous Topic:NullPointerException during first login in on Weblogic
Next Topic:Starting process using JMS Trigger
Goto Forum:
  


Current Time: Thu Sep 18 07:42:32 GMT 2014

Powered by FUDForum. Page generated in 0.04432 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software