|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Crazy 2009 JMS error on QueueSender.send() only |
« View previous topic :: View next topic » |
Author |
Message
|
crowne |
Posted: Fri Jan 08, 2010 7:49 am Post subject: Crazy 2009 JMS error on QueueSender.send() only |
|
|
Newbie
Joined: 08 Jan 2010 Posts: 4
|
Hi,
I have a JMS connection, and I can
- browse a queue successfully
- receive messages successfully
but as soon as I try to send a message it fails with reason code 2009.
Any pointers?
Thanks,
Neil.[/list] |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jan 08, 2010 3:41 pm Post subject: Re: Crazy 2009 JMS error on QueueSender.send() only |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
crowne wrote: |
Hi,
I have a JMS connection, and I can
- browse a queue successfully
- receive messages successfully
but as soon as I try to send a message it fails with reason code 2009.
Any pointers?
Thanks,
Neil. |
How about some code?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
crowne |
Posted: Sun Jan 10, 2010 11:03 pm Post subject: |
|
|
Newbie
Joined: 08 Jan 2010 Posts: 4
|
I have pasted the code that I am using below, I have marked in comments where the operations result in // SUCCESS or // FAIL
I forgot to mention that I can also publish to the queue successfully using the native MQ classes, just not using the JMS API.
Code: |
public void publishText(final String queueName, final String textMessage) throws JMSException {
QueueConnection connection = null;
try {
QueueConnectionFactory qcf = MQUtil.getQueueConnectionFactory(queueManagerName, host, port, channel);
connection = qcf.createQueueConnection();
connection.start();
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue(queueName);
// if (queue instanceof com.ibm.mq.jms.MQQueue) {
// MQQueue ibmQueue = (MQQueue) queue;
// ibmQueue.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
// }
{
QueueBrowser browser = session.createBrowser(queue);
Enumeration msgs = browser.getEnumeration();
// SUCCESS
while (msgs.hasMoreElements()) {
TextMessage testMsg = (TextMessage) msgs.nextElement();
System.out.println("BROWSE->" + testMsg.getText());
}
}
{
QueueReceiver receiver = session.createReceiver(queue);
TextMessage receivedMessage = (TextMessage) receiver.receive(1000);
//SUCCESS
System.out.println("-------------------------------------------------");
if (receivedMessage != null)
System.out.println("RECEIVED->" + receivedMessage.getText());
}
TextMessage message = session.createTextMessage(textMessage);
QueueSender sender = session.createSender(queue);
sender.send(message);
// FAIL
session.commit();
session.close();
} catch (JMSException e) {
Log.error(this.getClass().getName(), e);
Exception el = e.getLinkedException();
if (el != null)
Log.error(this.getClass().getName(), el);
throw e;
} finally {
if (connection != null) {
connection.close();
}
}
}
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jan 11, 2010 11:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
The only obvious thing I notice is that your session is not transacted yet you use
Quote: |
QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
....
session.commit();
... |
Stay consistent...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
crowne |
Posted: Mon Jan 11, 2010 12:05 pm Post subject: |
|
|
Newbie
Joined: 08 Jan 2010 Posts: 4
|
Hi thanks for the reply, I was playing around with various permutations to work out the problem, I was originally transactable=true, and changed it to false to see if that might fix the problem, but it didn't.
However its not all bad news, I have fixed the problem by upgrading the jar files to version 6.
Thanks,
Neil |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|