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 » Problems when writing message to QUEUE

Post new topic  Reply to topic
 Problems when writing message to QUEUE « View previous topic :: View next topic » 
Author Message
jfbaro
PostPosted: Fri Jun 05, 2009 5:37 am    Post subject: Problems when writing message to QUEUE Reply with quote

Novice

Joined: 05 Jun 2009
Posts: 10

Hi there,

We have an application which reads messages from a local queue (where its remote queue resides on IBM Mainframe) and then writes a response to a remote queue (where its local queue resides on IBM Mainframe).

The application can read the coming messages accordingly (through MDB) but after processing it one message has to be put into the remote queue, and is there where we get the following exception:

Code:
6/4/09 16:34:57:823 GMT-03:00]   39fb49 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adaptor for resource JMS$RSP_FACTORY$JMSManagedConnection@3539411.  The exception which was received is javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
[6/4/09 16:34:57:827 GMT-03:00]   39fb49 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adaptor for resource jms/RSP_FACTORY.  The exception which was received is javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
[6/4/09 16:34:57:829 GMT-03:00]   39fb49 WASLogger     E CLASSNAME METHODNAME an internal error has occurred. Please contact your system administrator. Detail: com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2019
[6/4/09 16:34:57:832 GMT-03:00]   39fb49 ConnectionEve A J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adaptor for resource JMS$RSP_FACTORY$JMSManagedConnection@3539411.  The exception which was received is javax.jms.JMSException: MQJMS2000: failed to close MQ queue


I have tested the same application on my development PC (With WSAD 5.1/WAS 5.1 - I don´t have a 5.0 here, unfortunately) and it works flawlessly.

The customer test environment is:

WAS 5.0.2.18 (running on cluster) on SunOS
MQServer 5.3.1

Please, could any one help us on that?

Regards[/code]
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jun 05, 2009 5:41 am    Post subject: Re: Problems when writing message to QUEUE Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jfbaro wrote:
The customer test environment is:

WAS 5.0.2.18 (running on cluster) on SunOS
MQServer 5.3.1

Please, could any one help us on that?


If your customer is running a version of MQServer that old on any distributed platorm it's not going to help anything! They seriously need to apply some maintenance...

When you tested in dev what WMQ was under your WAS 5.1?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jun 05, 2009 5:42 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Moving more directly to your issue, it's not impossible the Java support in the WMQv5.3.1 isn't everything it could be, and it's causing this 2019.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jfbaro
PostPosted: Fri Jun 05, 2009 5:58 am    Post subject: Reply with quote

Novice

Joined: 05 Jun 2009
Posts: 10

Hi Vitor,

I have asked the guys about the version we are using under WAS 5.1 (MS Vista) here and it is 5.3 from 04/09/2002 (MS XP SP2) .
Unlikely theirs our environment is not clustered (if this makes any difference regarding that problem).

Thanks for your help!

Cheers!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jun 05, 2009 6:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You probably need to upgrade MQ.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jun 05, 2009 6:08 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jfbaro wrote:
it is 5.3 from 04/09/2002 (MS XP SP2) .


Yes, but is it v5.3.1? You might have gone to a maintained version that actually worked with Java! It's generally held that anything much before CSD 11 is not worth the effort. And of course all the v5.3 versions are out of support.

jfbaro wrote:
Unlikely theirs our environment is not clustered (if this makes any difference regarding that problem).


It could well be your application is breaking trying to write to a clustered queue. Clustering wasn't too good under v5.3.1 either....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jfbaro
PostPosted: Fri Jun 05, 2009 6:34 am    Post subject: Reply with quote

Novice

Joined: 05 Jun 2009
Posts: 10

Thanks guys!

By talking to my manager he asked me to find some documentation from IBM saying similar environment won't work, so that we can go to that customer and say: "Look, our application will work fine if you have the right environment, look at that IBM paper which says exactly that".

I don't think IBM has such document/website, but in case anyone knows anything about that let me know, please.

P.S.: I am still searching, but had no joy so far.

Cheers!
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jun 05, 2009 6:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You should be able to show them the documentation that their level of WAS and MQ are not supported any more. That should be sufficient for you to get them to at least apply upgrades or to say that they can't use those levels with your code.

You need to determine from them, alas, if they are using WebSphere MQ, or the Embedded Messaging Provider in WAS 5.1. That was actually a modified version of WebSphere MQ, but not quite the same.
Back to top
View user's profile Send private message
jfbaro
PostPosted: Fri Jun 05, 2009 6:44 am    Post subject: Reply with quote

Novice

Joined: 05 Jun 2009
Posts: 10

Just in case that information is relevant or not.

The customer has used an IBM software to check if the queue is working properly (I think it is called mqami, something like that) and the queue worked fine.

We also have set the queue from remote to local but we get the same exception in both cases.

Thanks
Back to top
View user's profile Send private message
zpat
PostPosted: Fri Jun 05, 2009 7:28 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5849
Location: UK

I would be tempted to replace the usage of the MQ JAR files with those from the latest fixpack release of WMQ 5.3 or from v6.

You could place these JAR files in your local application classpath to overide the ancient ones you are picking up as a temporary workaround.

com.ibm.mq.jar
com.ibm.mq.jms.Nojndi.jar
com.ibm.mqjms.jar
connector.jar
dhbcore.jar
jms.jar
jndi.jar

You might obtain them by downloading and installing the appropriate WMQ client release.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jun 05, 2009 1:40 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jfbaro wrote:
The customer has used an IBM software to check if the queue is working properly (I think it is called mqami, something like that) and the queue worked fine.


The AMI is as obsolete as the version they're using.

jfbaro wrote:
By talking to my manager he asked me to find some documentation from IBM saying similar environment won't work, so that we can go to that customer and say: "Look, our application will work fine if you have the right environment, look at that IBM paper which says exactly that".


What you need to say instead is "Look, our application will work fine on any IBM-supported environment". The IBM website will confirm that all v5.3 versions of WMQ are unsupported.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jfbaro
PostPosted: Fri Jun 19, 2009 5:14 am    Post subject: Reply with quote

Novice

Joined: 05 Jun 2009
Posts: 10

Hi guys,

We were able to get it going (kinda) but using IBM´s MQ classes instead of, the most desirable by the customer, JMS.

At first even the com.ibm.mq implementation doesn't work either, unless I set the CCSID to 437, and in this case the message gets into the queue, but its value is all messed up. I think it has something to do with Encoding as the queue is a remote queue for one which resides on Z/OS (EBCDIC). If that is the case it will be simple to solve. We are yet to test that, hopefully later today.

There is a CCSID field on WAS for both QUEUE and QUEUE FACTORY, but I am not sure which of those I have to set neither if this will make any difference. I have tried to set CCSID only for the QUEUE and it apparently make no difference, so we keep getting the same error. Today I asked the customer to set both fields for CCSID and restart the application server, I am not convinced it will work though.

Does anyone have any suggestion/idea?

The ideal scenario would be to make it work (if possible) through JMS, but I don't know how to make the JMS configuration mimic the com.ibm.mq (code below).

Following the example we wrote using IBM´s MQ classes (We have the same code running as a Web Application, which yields the same result):

Code:
/*
 * Created on Jun 10, 2009
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
import java.io.IOException;

import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQException;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;

/**
 * Simple app to test MQ connectivity
 */
public class MQSender {

   private String host;
   private int port;
   private String userId;
   private String password;
   private String channel;
   private int charSet;
   private String encoding;
   private String queueManager;
   private String queueName;
   private MQQueueManager mqQueueManager;
   private MQPutMessageOptions mqPutMsgOptions;
   private MQQueue mqQueue;

   public MQSender(String host, int port, String channel, int charSet, String queueManager, String queueName, String userId, String password, String encoding) {
      
      this.host = host;
      this.port = port;      
      this.channel = channel;
      this.charSet = charSet;
      this.queueManager = queueManager;
      this.queueName = queueName;
      this.userId = userId;
      this.password = password;
      this.encoding = encoding;
            
   }
   
   public int init() throws MQException{
      
      System.out.println("Connecting to MQ...");

      MQEnvironment.hostname = host;
      MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
            MQC.TRANSPORT_MQSERIES_CLIENT);
      MQEnvironment.channel = channel;
      MQEnvironment.port = port;
      if (userId != null)
         MQEnvironment.userID = userId;
      if (password != null)
         MQEnvironment.password = password;
         
      MQEnvironment.CCSID = charSet;
      mqQueueManager = new MQQueueManager(queueManager);
      int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE
            | MQC.MQOO_FAIL_IF_QUIESCING;

      mqQueue = mqQueueManager.accessQueue(queueName,
            openOptions, null, null, null);

      mqPutMsgOptions = new MQPutMessageOptions();
      mqPutMsgOptions.options = MQC.MQPMO_NONE;
      
      System.out.println("Connected to MQ.");

      return 0;
      
   }// end of init

   public int sendMessage(String message) throws MQException, IOException  {
      init();

      System.out.println("Sending message to MQ.");
      
      MQMessage myPutMessage = new MQMessage();
      myPutMessage.clearMessage();
      myPutMessage.persistence = MQC.MQPER_NOT_PERSISTENT;
      myPutMessage.correlationId = MQC.MQCI_NONE;
      myPutMessage.messageId = MQC.MQMI_NONE;
      
      //if (encoding != null)         
         //message = (new String(message.getBytes(encoding)));         
      //else
         myPutMessage.characterSet = charSet;

      myPutMessage.writeString(message);
      mqQueue.put(myPutMessage, mqPutMsgOptions);
      
      System.out.println("Message sent to MQ.");

      this.end();
      return 0;
   }// end of action

   public int end() throws  MQException {
      
      System.out.println("Disconnecting from MQ...");
      mqQueue.close();
      mqQueueManager.disconnect();
      
      System.out.println("Disconnected from MQ...");
      
      return 0;
   }// end of end
   
   public static void main(String[] args) {
      
      try {         
         //String host, int port, String channel, int charSet, String queueManager, String queueName, String message, String userId, String password, String messageEncoding

         if (args.length < 7 || args.length > 10) {      
            System.out.println("\nWrong parameters:\n\nThe correct parameters are:\n\thost\n\tport\n\tchannel\n\tcharSet\n\tqueueManager\n\tqueueName\n\tmessage\n\t[userId]\n\t[password]\n\t[messageEncoding]");
            System.exit(1);            
         }   
         
         System.out.println("Total parameters:" + args.length);   
            
         String host = args[0];
         int port = Integer.parseInt(args[1]);
         String channel = args[2];      
         int charSet = Integer.parseInt(args[3]);
         String queueManager = args[4];
         String queueName = args[5];
         String message = args[6];
         
         MQSender mq = null;
         
         if (args.length == 8) {
            
            String ccsId = args[7];         
            
            mq = new MQSender(host, port, channel, charSet, queueManager, queueName, null, null, ccsId);
            
         } else if (args.length == 9) {
            
            String userId = args[7];
            String password = args[8];
            
            mq = new MQSender(host, port, channel, charSet, queueManager, queueName, userId, password, null);
            
         } else if (args.length == 10) {
            
            String userId = args[7];
            String password = args[8];
            String ccsId = args[9];
            
            mq = new MQSender(host, port, channel, charSet, queueManager, queueName, userId, password, ccsId);
               
         } else {
            mq = new MQSender(host, port, channel, charSet, queueManager, queueName, null, null, null);   
         }      
            
         mq.sendMessage(message);
         
      } catch (MQException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      
   }

}
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 » Problems when writing message to QUEUE
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.