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 using mq client under was 5.1

Post new topic  Reply to topic
 Problems using mq client under was 5.1 « View previous topic :: View next topic » 
Author Message
Richard
PostPosted: Thu May 06, 2004 11:26 pm    Post subject: Problems using mq client under was 5.1 Reply with quote

Newbie

Joined: 06 May 2004
Posts: 5

Environment:
Websphere server 5.1 (running under wsad dev environment).
Using 'embedded messaging' (selected on the JMS tab of server configuration).
Not using JMS !!!
Remote q is on mainframe (not sure of details there), but connecting via a q mgr on a windows 2000 box running mq server 5.3

When i run the code listed below as a stand-alone java main, i can look at the replyTo q and see a response message from the mainframe.
It always works.

Yet when i run the same code in a servlet, i never see a response from the mainframe.

So i figure there must be something different about the generated message, but i can't browse the remote q on the mainframe so i can't tell what has gone wrong. Does anybody have an inkling of what might be the problem? It's the exact same code!

Code:

String requestMessage = "...";
MQQueueManager qManager = null;
MQQueue requestQ = null;
MQQueue responseQ = null;
try
{
  Hashtable connectionProps = new Hashtable();
  connectionProps.put( MQC.HOST_NAME_PROPERTY, "AMPINTIBMMQ" );
  connectionProps.put( MQC.PORT_PROPERTY, new Integer( 1415 ) );
  connectionProps.put( MQC.CHANNEL_PROPERTY, "CLIENTS" );
         
  qManager = new MQQueueManager( "AMYSIND1", connectionProps );
         
  int queueOpenOptions = MQC.MQOO_OUTPUT |MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_SET_IDENTITY_CONTEXT;      
         
  requestQ = qManager.accessQueue( "AUTA.MS.DISPATCHER.REQUEST.CICSIIM.V2", queueOpenOptions, "MQT2.MA", null, null );

  MQPutMessageOptions mqpmo = new MQPutMessageOptions();
  mqpmo.options = mqpmo.options | MQC.MQPMO_NEW_MSG_ID;
  mqpmo.options = mqpmo.options | MQC.MQPMO_SET_IDENTITY_CONTEXT;

  MQMessage mqRequest = new MQMessage();
  mqRequest.applicationIdData = "INCLIENTINQUIRY";
  mqRequest.expiry = 600;
  mqRequest.format = MQC.MQFMT_STRING;
  mqRequest.messageType = MQC.MQMT_REQUEST;
  mqRequest.persistence = MQC.MQPER_NOT_PERSISTENT;
  mqRequest.priority = 5;
  mqRequest.replyToQueueManagerName = "AMYSIND1.MA";
  mqRequest.replyToQueueName = "AUTA.MS.CLIENT.REPLY";
  mqRequest.userId = "INTEG13";
                  
  mqRequest.writeString( requestMessage );
                  
  requestQ.put( mqRequest, mqpmo );                        
}
catch( MQException mqe ) { mqe.printStackTrace(); }
catch( IOException ioe ) { ioe.printStackTrace(); }
finally
{
  if( requestQ != null ) try { requestQ.close(); }catch( Exception e ) { e.printStackTrace(); }
  if( responseQ != null ) try { responseQ.close(); }catch( Exception e ) { e.printStackTrace(); }
  if( qManager != null ) try { qManager.disconnect(); }catch( Exception e ) { e.printStackTrace(); }
}
Back to top
View user's profile Send private message Send e-mail
bower5932
PostPosted: Fri May 07, 2004 6:07 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

You could always change your destination queue to be a local queue. You could then put the message from both the servlet and stand-alone to see what the difference is. My guess would be that the servlet is running under a different userid than the stand-alone and you are suffering from security problems.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
jefflowrey
PostPosted: Fri May 07, 2004 6:24 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Also, check your appserver logs for any exceptions being generated when the servlet runs.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri May 07, 2004 6:56 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It also occurs to me that you may not be able to use the embedded messaging MQ classes as a regular MQ client.

IBM claims that "embedded messaging" can't be used to communicate with a different machine - and that may include being used as a client.

So try installing the regular MQ Java client classes somewhere and using those with your code.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri May 07, 2004 7:38 am    Post subject: Re: Problems using mq client under was 5.1 Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Richard wrote:
Remote q is on mainframe (not sure of details there), but connecting via a q mgr on a windows 2000 box running mq server 5.3

I took this to mean that he had installed the full MQ and was letting his AppServer treat it as embedded JMS. Is this not the case?
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
fjb_saper
PostPosted: Fri May 07, 2004 7:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You have to use Websphere MQ JMS
You cannot use Websphere JMS tab in server config (remove any configuration you did there this relates to the "embedded server")
Start Server (first make sure the admin console is enabled)
Go to Admin console
Go to the Resource tab
Go to Websphere MQ JMS
Make sure you define MQJMS_LIB_ROOT variable
define your JMS MQ Config there
SAVE
Restart the server
Now your servlet should work

Have fun
Back to top
View user's profile Send private message Send e-mail
Richard
PostPosted: Sun May 09, 2004 5:31 pm    Post subject: Problem solved - not an mq issue ! Reply with quote

Newbie

Joined: 06 May 2004
Posts: 5

Firstly, i really want to thank everyone for their responses... i was feeling very discouraged and your responses made me think there may be a light switch in the tunnel somewhere.

Secondly, i feel a bit embarassed because it had nothing to do with mq.
The content of the request message was xml. In the command line test case the xml was in one long string i defined in the code. In the servlet test case the request message came from a posted parameter. It turns out that they have some dodgey xml parser in cobol that can't handle embedded new-line carriage-return characters (or even spaces) between the xml tags. I had the new-lines in the servlet test, but not in the 'main' test.
Anyway, i want to apologise for wasting peoples time with this one.

Thirdly, just to clarify some of the questions that came up relating to the environment:
I am running in wsad 5.1.1, with a v5.1 was server test environment.
I have 'Websphere embedded messaging' installed, which i got from the wsad installation cd. My understanding is that this is not the full Websphere MQ product. This is at CSD04.
I had previously configured some JMS queues in the server admin panel because we are using those for some internal messaging to handle asynchronus operations. When this was set-up the 'JMS Provider' on the JMS tab was set to 'MQ Simulator for Java Developers'. It was necessary to change this to 'Embedded Messaging' for my pure mq client code to work.
Anyway, since fixing the xml issue, this setup works fine for connecting to remote q's.

Thanks all.
Back to top
View user's profile Send private message Send e-mail
bower5932
PostPosted: Mon May 10, 2004 5:25 am    Post subject: Re: Problem solved - not an mq issue ! Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Richard wrote:
When this was set-up the 'JMS Provider' on the JMS tab was set to 'MQ Simulator for Java Developers'.

Personally, I avoid using the MQJD. I figure that I want to test with something that is more like the real environment.

Richard wrote:
It was necessary to change this to 'Embedded Messaging' for my pure mq client code to work.

If this means that you have MQ Java (not JMS) code being run against the embedded messaging, I believe this is a violation of the license agreement. It is my understanding that embedded messaging is to be used only for JMS code inside the AppServer (or a J2EE application client).
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Richard
PostPosted: Mon May 10, 2004 7:09 pm    Post subject: Re licensing Reply with quote

Newbie

Joined: 06 May 2004
Posts: 5

Quote:
If this means that you have MQ Java (not JMS) code being run against the embedded messaging, I believe this is a violation of the license agreement. It is my understanding that embedded messaging is to be used only for JMS code inside the AppServer (or a J2EE application client).


I'm not sure what you mean by 'being run against the embedded messaging'. It uses the embeded messaging, specifically, com.ibm.mq.jar to communicate with an mq server on a remote machine.

I had a chat with our licensing guy. He said that:
'mq server' - you have to pay for.
'mq transactional clent' - you have to pay for.
'mq client' - you don't have to pay for.
So since the code i wrote uses mq client code (in com.ibm.mq.jar), in a non-transactional manner, it's ok.

However, i did find this: http://www-1.ibm.com/support/docview.wss?rs=180&context=SSEQTP&q=&uid=swg21105544&loc=en_US&cs=utf-8&lang=en which i think is seriously ambiguous! So our licensing guy is going to talk to the ibm rep to clarify the situation.
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Mon May 10, 2004 8:23 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

If your client code (non-JMS) is talking to a WMQ Server that you have paid for then you are ok. But if your client code is talking to an WAS embedded MQ server then you are not ok.

Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
bower5932
PostPosted: Tue May 11, 2004 5:20 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Richard, that is a great URL above. I can't say that I've seen it before. I also think that Roger clarifies my statement when he mentions that your client should be talking to a paid for MQ server. That is what I was trying to say.

Regardless, it is definitely a confusing situation.....
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Problems using mq client under was 5.1
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.