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 » MQ Client - Server Connection With Java

Post new topic  Reply to topic Goto page 1, 2  Next
 MQ Client - Server Connection With Java « View previous topic :: View next topic » 
Author Message
zulkernain.kanjariwala
PostPosted: Thu Dec 03, 2009 10:30 pm    Post subject: MQ Client - Server Connection With Java Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

Dear All,
I am new to the world of MQ and got an assignment to Create a Java program which will send the message from the Client To Server.

Let me explain my technical Scenario,

Client Machine
OS : Windows XP
MQ : V5.3 - Client


Server Machine
OS : Windows 2000 Adv Server
MQ : V5.3 - Server



I have read the books published by IBM, about the Intercommunication, Clients, Using Java, & other Stuff

So i have created the Two Queue Manager in my Server.

Named: AQM , BQM

AQM Configuration:
Channel :
A.TO.B - Sender Channel
B.TO.A - Reciever Channel

Queues:
A.INCOMING
BQM
B.INCOMING
Dead.Letter

Listener:
1411


BQM Configuration:
Channel :
B.TO.A - Sender Channel
A.TO.B - Reciever Channel

Queues:
B.INCOMING
AQM
A.INCOMING
Dead.Letter

Listener:
1415


Now, if i send the message from the First Step's API Excercise, the message from A To B is going smoothly.

But, i want to send the message from the client machine to the server through java.

I am totally confused, please let me know where i am lacking.
Back to top
View user's profile Send private message
manicminer
PostPosted: Fri Dec 04, 2009 12:47 am    Post subject: Re: MQ Client - Server Connection With Java Reply with quote

Disciple

Joined: 11 Jul 2007
Posts: 177

zulkernain.kanjariwala wrote:
Dear All,
I am new to the world of MQ and got an assignment to Create a Java program which will send the message from the Client To Server.

*snip*

But, i want to send the message from the client machine to the server through java.

I am totally confused, please let me know where i am lacking.


First thing is first, 5.3 is very very old, and out of support. If you are developing a new system you should really be installing V7.

Secondly the best starting point would be the installed sample applications, there should be sample code for connecting to a queue manager and sending a message using the Java API. (and the JMS API for that matter).

To connect via any client you need a listener running on the server and you need an appropriate channel defined.

In your program you will set the remote machine name, port, and the channel you want to connect on.

Check out the Java manual for more Java specific information:

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/uj10120_.htm
_________________
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Back to top
View user's profile Send private message
zulkernain.kanjariwala
PostPosted: Fri Dec 04, 2009 1:00 am    Post subject: Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

Hi Dear!
I really appreciate your reply, i know that 5.3 is very old version, but right now i am having that only.

i have to work on it.

I have tried with some sample, but those are also giving error so for what it is coming i dont know..

do u have any sample code which is workin?
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Fri Dec 04, 2009 1:10 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

What error are you seeing?

Are you seeing an MQ Reason Code from the Java app when it attempts to connect / put the message or is it just that you do not see the message as expected?

Have you looked on transmission / Dead Letter Queues. Where have you looked and what have you tried to work out what is going wrong?
Back to top
View user's profile Send private message
zulkernain.kanjariwala
PostPosted: Fri Dec 04, 2009 1:40 am    Post subject: Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

When i am running my Program, i am getting the Reason Code as per the following condition.


If i give the OpenOptions=MQC.MQOO_INPUT_EXCLUSIVE | MQC.MQOO_BROWSE

i am getting reason code 2045.

If i give the OpenOptions= MQC.MQOO_OUTPUT

i am getting reason code 2037.


And i in the channel configuration if i am putting Channel name as the Sender channel (A.TO.B) i am getting Reason Code 2009.

So i have created Server Connection Channel then i got the above two condition of the Reason Code.

Is there any new configuration required?


I am getting following Error in AMQERRLOG1.Log of My Server's Queue Manager.

12/04/2009 14:45:54
AMQ9208: Error on receive from host SAM (***.***.***.***).

EXPLANATION:
An error occurred receiving data from SAM (***.***.***.***) over TCP/IP. This
may be due to a communications failure.
ACTION:
The return code from the TCP/IP (recv) call was 10054 (X'2746'). Record these
values and tell the systems administrator.
----- amqccita.c : 2761 -------------------------------------------------------
12/04/2009 14:50:54
AMQ9208: Error on receive from host SAM (***.***.***.***).

EXPLANATION:
An error occurred receiving data from SAM (***.***.***.***) over TCP/IP. This
may be due to a communications failure.
ACTION:
The return code from the TCP/IP (recv) call was 10054 (X'2746'). Record these
values and tell the systems administrator.
----- amqccita.c : 2761 -------------------------------------------------------
Back to top
View user's profile Send private message
manicminer
PostPosted: Fri Dec 04, 2009 3:06 am    Post subject: Reply with quote

Disciple

Joined: 11 Jul 2007
Posts: 177

zulkernain.kanjariwala wrote:
When i am running my Program, i am getting the Reason Code as per the following condition.


If i give the OpenOptions=MQC.MQOO_INPUT_EXCLUSIVE | MQC.MQOO_BROWSE

i am getting reason code 2045.

If i give the OpenOptions= MQC.MQOO_OUTPUT

i am getting reason code 2037.


And i in the channel configuration if i am putting Channel name as the Sender channel (A.TO.B) i am getting Reason Code 2009.

So i have created Server Connection Channel then i got the above two condition of the Reason Code.

Is there any new configuration required?


Server Conn should be ok for connecting, have you tried using "mqrc" to find out more about the return code values? Also have you tried looking on google / these forums for solutions to those return codes?

Which queue are you trying to open? and how is it defined? For example you cannot get messages from a remote queue definition, only a queue defined as a local queue.
_________________
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Back to top
View user's profile Send private message
zulkernain.kanjariwala
PostPosted: Fri Dec 04, 2009 3:28 am    Post subject: Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

Hi mani,

i have checked both the reason code but both are contradictory, if i am using the solution of 2037 then it is giving 2045 error and vice versa.

and i am opening the remote definition queue to put the message into it.

just look at the following code:

import com.ibm.mq.*;
import com.ibm.mq.MQException;
public class MyProgram
{
private static String hostname = "abc-" ; // My Server's Hostname where i have installed Websphere MQ V5.3 Server
private static String channel = "SERV" ; // Server Connection Channel Created in AQM
private static String qManager = "AQM" ; // Queue Manager AQM
private static MQQueueManager qMgr;
public static void main(String args[])
{
initA();
StartA();
}
public static void initA()
{
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
MQEnvironment.port = 1411;
}
public static void StartA()
{
try
{
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Here B.INCOMING is Remote Queue of My Queue Manager AQM
MQQueue system_default_local_queue = qMgr.accessQueue("B.INCOMING",openOptions,null,null,null);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!" ) ;
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(hello_world,pmo);
system_default_local_queue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
System.out.println("An MQ error occurred : Completion code " +
ex.completionCode +
" Reason code " + ex.reasonCode);
}
catch (java.io.IOException ex)
{
System.out.println("An error occurred while writing to the message buffer: " + ex);
}
}
}
Back to top
View user's profile Send private message
manicminer
PostPosted: Fri Dec 04, 2009 5:14 am    Post subject: Reply with quote

Disciple

Joined: 11 Jul 2007
Posts: 177

zulkernain.kanjariwala wrote:

just look at the following code:


int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
// Here B.INCOMING is Remote Queue of My Queue Manager AQM
MQQueue system_default_local_queue = qMgr.accessQueue("B.INCOMING",openOptions,null,null,null);


manicminer wrote:
For example you cannot get messages from a remote queue definition


You are trying to open a remote queue for input, you can't do that.
_________________
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Back to top
View user's profile Send private message
zulkernain.kanjariwala
PostPosted: Fri Dec 04, 2009 5:37 am    Post subject: Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

Yes Mani!
I am trying to open Remote Queue, the purpose of putting message in to forward that message directly to another Qmanager.

I have tried to put the message in Local Queue and is going on well. So atleast i have reached that point.

So i want to know if i wanna automate the message from the local queue to remote queue of the same qmanager so how could i do that?

Do i need to write server side program to read the message from the local queue and put the message to remote queue to forward that message to the another queue manager?

or

Any other solution is there? Please let me know. as i am standing at the edge of the completion.

Thank You Very Much Mani for help.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Dec 04, 2009 6:01 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can't read from remote queues.

You can only write to them.

MQ makes the message you write to a remote queue move to other queue manager for you.

As if it were magic.
Back to top
View user's profile Send private message
zulkernain.kanjariwala
PostPosted: Fri Dec 04, 2009 6:16 am    Post subject: Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

Dear Jeff!
I am trying to put the message into Remote Queue only. I am not reading message from Remote Queue.

But when i am trying to put the message into remote queue i am getting error of Reason Code 2045. This Error is Coming while i am giving option

openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;

When i remove Input As Q Def then i am not getting any error on the client prompt. but into AMQERR01.log at server side i am getting the following error.

12/04/2009 19:24:01
AMQ9208: Error on receive from host SAM (10.144.131.202).

EXPLANATION:
An error occurred receiving data from SAM (10.144.131.202) over TCP/IP. This
may be due to a communications failure.
ACTION:
The return code from the TCP/IP (recv) call was 10054 (X'2746'). Record these
values and tell the systems administrator.
----- amqccita.c : 2761 -------------------------------------------------------



So Please tell me what should i do?
Back to top
View user's profile Send private message
mvic
PostPosted: Fri Dec 04, 2009 7:22 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

zulkernain.kanjariwala wrote:
When i remove Input As Q Def then i am not getting any error on the client prompt.

This is progress. Do you mean, the app runs successfully to completion?

Quote:
but into AMQERR01.log at server side i am getting the following error.[/b]

12/04/2009 19:24:01
AMQ9208: Error on receive from host SAM (10.144.131.202).

EXPLANATION:
An error occurred receiving data from SAM (10.144.131.202) over TCP/IP. This
may be due to a communications failure.
ACTION:
The return code from the TCP/IP (recv) call was 10054 (X'2746'). Record these
values and tell the systems administrator.
----- amqccita.c : 2761 -------------------------------------------------------

This is now a very different problem.

Assuming you have permanently removed the incorrect OpenOptions when opening a handle to the remote q, we can move on.

The error number 10054 can be looked up by searching the internet. It is WSAECONNRESET.

Or if you drop the letters WSA, it is similar to the Unix errno ECONNRESET. This means the network connection was reset, or "broken".

Connection breaks can be done by firewalls. Do you have firewalls in hardware or software between your client and your server?
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Dec 04, 2009 7:52 am    Post subject: Reply with quote

Grand High Poobah

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

Try going back to what you were working on a year ago, when you had this thread running. You seem to be covering a lot of the same ground here.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
zulkernain.kanjariwala
PostPosted: Sun Dec 06, 2009 9:42 pm    Post subject: Reply with quote

Novice

Joined: 28 Nov 2008
Posts: 24

Dear Victor!

Thanks for remind me again about the past . But at that time i was facing some another issue because at that time i was a newbie into this area.

Dear All!!

By the way, thanks all of you becuase i found out the issue and got it done.

I really appreciate the help got from you master people.

Back to top
View user's profile Send private message
manicminer
PostPosted: Mon Dec 07, 2009 1:24 am    Post subject: Reply with quote

Disciple

Joined: 11 Jul 2007
Posts: 177

zulkernain.kanjariwala wrote:
Dear All!!

By the way, thanks all of you becuase i found out the issue and got it done.

I really appreciate the help got from you master people.



Would you mind posting back exactly what you did to solve the problem?

It will be useful for people in the future who are searching for forums looking for a solution.
_________________
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ Java / JMS » MQ Client - Server Connection With Java
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.