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 » CCDT in JAVA

Post new topic  Reply to topic Goto page 1, 2  Next
 CCDT in JAVA « View previous topic :: View next topic » 
Author Message
kalam475
PostPosted: Wed Nov 09, 2016 7:19 am    Post subject: CCDT in JAVA Reply with quote

Acolyte

Joined: 16 Jan 2015
Posts: 63

Is there any sample program to use CCDT file to connect to queue manager.


I am trying this code
Code:

try {
     String QM =    "QM1";
     String QUEUE1 = "TARGET";

     System.out.println("Starting MQClient Put Program: ");
     java.net.URL chanTab1  = new URL("file:///D:/ccdt/AMQCLCHL.TAB") ;
     chanTab1.openConnection();
        System.out.println("jslslsjjf");
     queueManager = new MQQueueManager(QM, chanTab1);

     System.out.println("Connected to QMGR ");
     int openOptions = MQC.MQOO_OUTPUT;
     MQQueue InQueue = queueManager.accessQueue(QUEUE1,openOptions,null,null,null);
     MQMessage inMessage = new MQMessage();
     inMessage.writeString("###Testing####");
     InQueue.put(inMessage);
     System.out.println("Message Id is :" + Arrays.toString(inMessage.messageId));
     System.out.println(inMessage.toString());
     InQueue.close();
     queueManager.disconnect() ;
 }
 catch(MQException ex){
     System.out.println("MQ Error - Reason code :" + ex.reasonCode);
 }
 catch (IOException e){
     System.out.println("Error : " + e);



I am getting this error MQ Error - Reason code :2059

Please help. thanks in advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 09, 2016 7:37 am    Post subject: Re: CCDT in JAVA Reply with quote

Grand High Poobah

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

kalam475 wrote:
I am getting this error MQ Error - Reason code :2059


How do you know the code is the problem? A 2059 can result from environmental issues (like firewalls).
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kalam475
PostPosted: Wed Nov 09, 2016 7:43 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2015
Posts: 63

I was using simple java program from same client machine and was able to connect to queue manager and put the message in one of the queues.

with same channel.

Also if you have any example of this sorts do tell where to find one.

I am searching from morning.
Back to top
View user's profile Send private message
kalam475
PostPosted: Wed Nov 09, 2016 7:45 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2015
Posts: 63

without CCDT file I am able to connect normally by setting the MQEnvironment
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 09, 2016 8:36 am    Post subject: Reply with quote

Grand High Poobah

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

So the answer to my question is, "it works fine without a CCDT". Good answer.

I'll defer to one of my more Java literate associates on your language specific questions.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
hughson
PostPosted: Wed Nov 09, 2016 2:31 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Could you also enlighten us as to the contents of your CCDT?

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
tczielke
PostPosted: Wed Nov 09, 2016 6:33 pm    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 939
Location: Illinois, USA

This how I got a CCDT to work with the IBM MQ Classes for Java in one of my Java samples on Unix:

Code:

      java.net.URL chanTab1 = new URL("file:///export/home/mqm/java_code/AMQCLCHL_TCZ.TAB");
      MQQueueManager qMgr = new MQQueueManager(qManager, chanTab1);


The code you have does look right for Windows, although this line that you have does look odd to me:

Code:

     chanTab1.openConnection();


Can you elablorate on what was the purpose of that above line?
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
kalam475
PostPosted: Wed Nov 09, 2016 11:36 pm    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2015
Posts: 63

How can we read the contents of the CCDT file (AMQCLCHL.TAB). I have tried using mo72-7.5 .

I am using MQ 9.0 so i think there is compatibility problem when i am trying to DISPLAY CHANNEL(*) the error it is showing is "Segmentation fault (core dumped)"

And also i run my program in linux and now it is showing the error MQRC 2538

I have checked
1. My listener is running
2. Firewall is off
3. I am able to ping and telnet the port on which my queue manager is running


That leaves me with only one possible scenario that there is a problem with my CCDT file

Can anyone help me how to read the file and correct it if there is any error in the file.



The whole idea of doing this is to connect to a multi instance queue manager with automatic client re-route. I want to do it in JAVA.

IS there any possible way apart from CCDT file.

Thanks for your reply and help.
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Nov 10, 2016 1:14 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

runmqsc -n

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
kalam475
PostPosted: Thu Nov 10, 2016 1:38 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2015
Posts: 63

Here are my channel details from CCDT file

DISPLAY CHANNEL(*)
4 : DISPLAY CHANNEL(*)
AMQ8414: Display Channel details.
CHANNEL(CHANNEL1) CHLTYPE(CLNTCONN)
AMQ8414: Display Channel details.
CHANNEL(SYSTEM.DEF.CLNTCONN) CHLTYPE(CLNTCONN)
----------------------------------------------------------------------------------

Display Channel(channel1)
1 : Display Channel(channel1)
AMQ8414: Display Channel details.
CHANNEL(CHANNEL1) CHLTYPE(CLNTCONN)
AFFINITY(PREFERRED) ALTDATE(2016-10-31)
ALTTIME(22.57.26) CERTLABL( )
CLNTWGHT(0) COMPHDR(NONE)
COMPMSG(NONE)
CONNAME(mq1.tec.com (1416),mq2.tec.com (1416))
DEFRECON(NO) DESCR( )
HBINT(300) KAINT(AUTO)
LOCLADDR( ) MAXMSGL(4194304)
MODENAME( ) PASSWORD( )
QMNAME(QM1) RCVDATA( )
RCVEXIT( ) SCYDATA( )
SCYEXIT( ) SENDDATA( )
SENDEXIT( ) SHARECNV(10)
SSLCIPH( ) SSLPEER( )
TPNAME( ) TRPTYPE(TCP)
USERID( )





It is showing only CHLTYPE(CLNTCONN) but not my Server connection channel CHANNELL1

IS that the problem.
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Nov 10, 2016 2:26 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

Your SVRCONN channel is not defined in the CCDTURL, it defined on the queue manager. If you use runmqsc to your queue manager (i.e. without the -n flag) you can see whether your SVRCONN has been defined.

kalam475 wrote:
I am able to ping and telnet the port on which my queue manager is running.


And which hostname and port number is that since you have two in your channel's CONNAME? Might be worth trying with just one initially, get that working and then move to the comma separated list?

btw, what MQRC are you getting now, as you have mentioned two.

Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
kalam475
PostPosted: Thu Nov 10, 2016 3:14 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2015
Posts: 63

Now I am getting the error MQ Error - Reason code :2538
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Nov 10, 2016 1:22 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

2538 is MQRC_HOST_NOT_AVAILABLE.

You have two host names in your CONNAME, which of them is where you queue manager and listener are currently running?

I would repeat my suggestion that you get your CCDT working with only one hostname and port in the CONNAME of your CLNTCONN channel first. Then you'll know that your application works and your queue manager and listener are all set up correctly too, and then think about multiple connames.

Have you tried this yet?
Cheers
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
RogerLacroix
PostPosted: Thu Nov 10, 2016 4:33 pm    Post subject: Reply with quote

Jedi Knight

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

Hi kalam475,

I have no idea what you are doing in your code. You need to simplify. Did you use Mr. Google? Because my UFM open source program should have come up and is a perfect example for using a CCDT file.

Here's a snippet:
Code:
File file = new File(CCDTFile);
URL url = file.toURL();
qMgr = new MQQueueManager(qMgrName, url);

where CCDTFile would be:
- On Windows, "D:\ccdt\AMQCLCHL.TAB"
- On Unix/Linux, "/home/user/ccdt/AMQCLCHL.TAB"

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Fri Nov 11, 2016 5:35 am    Post subject: Reply with quote

Grand High Poobah

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

Don't know if it is a typo but CHANNEL1 and CHANNELL1 are not the same thing. Remember the client channel name MUST match EXACTLY (including case) the name of the server connection channel.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
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 » CCDT in 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.