|
| Hi!
I'm trying to send a message to an MQ-queue in a task command but I cant
seem to get it right. When I try to send the message to the queue I get the
following exception:
[2004-12-06 17:25:37:969 CET] 7e3b33c4 TransactionIm E WTRN0062E: An illegal
attempt to use multiple resources that have only one-phase capability has
occurred within a global transaction.
Here's my code:
jndiContext = new InitialContext();
queueConnectionFactory = (QueueConnectionFactory)
jndiContext.lookup("JMSQueueConnectionFactory");
queueSend = (Queue) jndiContext.lookup("JMSOutboundInventoryQueue");
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
QueueSender sender = queueSession.createSender(queueSend);
sender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
queueConnection.start();
TextMessage sendMessage = queueSession.createTextMessage("This is a test");
sender.send(sendMessage);
sender.close();
Any help would be greatly appreciated!
/Anders
|
|