|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
sending message as a java client |
« View previous topic :: View next topic » |
Author |
Message
|
pvsp |
Posted: Sun Feb 17, 2008 4:14 am Post subject: sending message as a java client |
|
|
Apprentice
Joined: 17 Feb 2008 Posts: 36 Location: Warsaw, PL
|
Hi,
I'm not familar with MRseries because I've started learning a few days ago.
I have some troubles with establishing connection to Queue Manager using Java.
At first I have create a local queue, remote queue and client-server configuration as is described in IBM WebSpgere contact admin
(it is examle with MQ_APPLE and MQ_ORANGE). Everything is right. I tested it using 'amqsputc' (the MQSERVER environment is set to
'CLIENT.QM_ORANGE/TCP/localhost (1415)') and is ok.
Next, I wanted to create a simple java application like 'amqsputc'. I found pdf about MQ Java classes (in setup dictionary) and
I've created a simple application based on information from that doc. Unfortunately, during creating the MQQueueManager object I
got the exception like this:
MQJE001: An MQException occurred: Completion Code 2, Reason 2195
MQJE020: CCSID not supported by queue manager
MQJE001: An MQException occurred: Completion Code 2, Reason 2195
MQJE020: CCSID not supported by queue manager
An MQSeries error occurred : Completion code 2 Reason code 2195
Can sb give me some advice ? |
|
Back to top |
|
 |
pvsp |
Posted: Sun Feb 17, 2008 4:16 am Post subject: |
|
|
Apprentice
Joined: 17 Feb 2008 Posts: 36 Location: Warsaw, PL
|
I forgot put the code
Code: |
public class MQSample {
private String qManager = "QM_ORANGE"; // define name of queue
private MQQueueManager qMgr;
public void init() {
MQEnvironment.hostname = "localhost"; //
MQEnvironment.channel = "CLIENT.QM_ORANGE"; // channel type - server-connection
MQEnvironment.port=1415;
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
}
public void start() {
try {
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
MQQueue system_default_local_queue = qMgr.accessQueue(
"Q1", openOptions);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!");
MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the
system_default_local_queue.put(hello_world, pmo);
system_default_local_queue.close();
qMgr.disconnect();
} catch (MQException ex) {
System.out.println("An MQSeries error occurred : Completion code "
+ ex.completionCode + " Reason code " + ex.reasonCode);
}
catch (java.io.IOException ex) {
System.out
.println("An error occurred whilst writing to themessage buffer: "
+ ex);
}
}
} |
[/code] |
|
Back to top |
|
 |
Vitor |
Posted: Sun Feb 17, 2008 4:53 am Post subject: Re: sending message as a java client |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pvsp wrote: |
MQJE020: CCSID not supported by queue manager
|
However your Java is running, it's using a code page alien to the queue manager. I'd no idea you could even DO that, but that shows what I know about Java.
You need to identify what code page your Java (JVM??) is using, and the page the queue manager has been set it. These need to be compatable, or ideally the same. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
pvsp |
Posted: Sun Feb 17, 2008 5:11 am Post subject: |
|
|
Apprentice
Joined: 17 Feb 2008 Posts: 36 Location: Warsaw, PL
|
I found here http://www-03.ibm.com/systems/i/software/globalization/default_list.html that my codepage is 1250, so I set it using
MQEnvironment.CCSID=1250;
and the MQQueueManager was created, but now I have exception like
MQJE001: Completion Code 2, Reason 2045
An MQSeries error occurred : Completion code 2 Reason code 2045
after executing
MQQueue system_default_local_queue = qMgr.accessQueue(
"Q1", openOptions); |
|
Back to top |
|
 |
Vitor |
Posted: Sun Feb 17, 2008 5:29 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pvsp wrote: |
MQJE001: Completion Code 2, Reason 2045 |
And what did you find out when you looked this code up?
I suspect that Q1 is your remote queue, and this is the cause of your problem. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
pvsp |
Posted: Sun Feb 17, 2008 6:04 am Post subject: |
|
|
Apprentice
Joined: 17 Feb 2008 Posts: 36 Location: Warsaw, PL
|
Vitor wrote: |
pvsp wrote: |
MQJE001: Completion Code 2, Reason 2045 |
And what did you find out when you looked this code up?
I suspect that Q1 is your remote queue, and this is the cause of your problem. |
I found 'JMS: Putting to a remote fully qualified queue which is not
in a cluster results in a failure after upgrading from
CSD05 to CSD06. This results in error:
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason
2045'
and you are right it is caused by remote queue, local is fine. Now, I'm looking for how to put messages to the remote queue.
Thanks for all information.  |
|
Back to top |
|
 |
Vitor |
Posted: Sun Feb 17, 2008 6:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
pvsp wrote: |
I found 'JMS: Putting to a remote fully qualified queue which is not
in a cluster results in a failure after upgrading from
CSD05 to CSD06. This results in error:
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason
2045'
|
I meant looking it up in the codes manual - your problem is much simpler, and is the answer to your remote queue question.
Also if you're using anything old enough for CSD06 to be relevant, don't. Using Java on anything less than v5.3.10 is very dubious.
And unsupported. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
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
|
|
|
|