Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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 KanjiyaniFriend
Messages: 19
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();
QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = queueSession.createSender(queue);
TextMessage message = queueSession.createTextMessage();
message.setText("Hello World");

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(
at javax.naming.InitialContext.lookup(
at ca.uleth.jms.Main.main(
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 ScheufenFriend
Messages: 77
Registered: October 2011

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,

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

Current Time: Sun Jun 24 09:35:15 GMT 2018

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

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

Back to the top