I am trying to use JMS to send message to a durable queue by referring the
"SimpleQueueSender" example. Below is my code that I am using inside my
interceptor module. 
I have defined the queue in broker.xml. However, when I run the broker
instance I get the below error

ERROR [org.apache.activemq.artemis.core.server] AMQ224000: Failure in
initialisation: java.security.PrivilegedActionException:
javax.naming.NameNotFoundException; remaining name 'QueueConnectionFactory'
..
..
Caused by: javax.naming.NameNotFoundException; remaining name
'QueueConnectionFactory'

Could someone please guide me what I might be missing? Does it needs any
more configuration or something? Much Appreciated.

My code:

        Context jndiContext = new InitialContext();
        QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory)
jndiContext.lookup("QueueConnectionFactory");
        Queue queue = (Queue) jndiContext.lookup("exampleQueue");
        QueueConnection queueConnection  =
queueConnectionFactory.createQueueConnection();
        QueueSession queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
        MessageConsumer consumer = queueSession.createConsumer(queue);
        QueueSender queueSender = queueSession.createSender(queue);
        ObjectMessage message = queueSession.createObjectMessage();
        message.setObject(results);
        queueSender.send(message);
        queueSender.send(queueSession.createMessage());
        queueConnection.close();

broker.xml

   <jms xmlns="urn:activemq:jms">
      <queue name="exampleQueue">
         <durable>true</durable>
      </queue>
   </jms>



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Using-JMS-in-ActiveMQ-Artemis-tp4715693.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Reply via email to