ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Crazy 2009 JMS error on QueueSender.send() only

Post new topic  Reply to topic
 Crazy 2009 JMS error on QueueSender.send() only « View previous topic :: View next topic » 
Author Message
crowne
PostPosted: Fri Jan 08, 2010 7:49 am    Post subject: Crazy 2009 JMS error on QueueSender.send() only Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Fri Jan 08, 2010 3:41 pm    Post subject: Re: Crazy 2009 JMS error on QueueSender.send() only Reply with quote

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
View user's profile Send private message Send e-mail
crowne
PostPosted: Sun Jan 10, 2010 11:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Jan 11, 2010 11:35 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
crowne
PostPosted: Mon Jan 11, 2010 12:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Crazy 2009 JMS error on QueueSender.send() only
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.