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 » sending message as a java client

Post new topic  Reply to topic
 sending message as a java client « View previous topic :: View next topic » 
Author Message
pvsp
PostPosted: Sun Feb 17, 2008 4:14 am    Post subject: sending message as a java client Reply with quote

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
View user's profile Send private message
pvsp
PostPosted: Sun Feb 17, 2008 4:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Sun Feb 17, 2008 4:53 am    Post subject: Re: sending message as a java client Reply with quote

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
View user's profile Send private message
pvsp
PostPosted: Sun Feb 17, 2008 5:11 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Sun Feb 17, 2008 5:29 am    Post subject: Reply with quote

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
View user's profile Send private message
pvsp
PostPosted: Sun Feb 17, 2008 6:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Sun Feb 17, 2008 6:10 am    Post subject: Reply with quote

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
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 » sending message as a java client
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.