Author |
Message
|
kalam475 |
Posted: Wed Nov 09, 2016 7:19 am Post subject: CCDT in JAVA |
|
|
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 |
|
 |
Vitor |
Posted: Wed Nov 09, 2016 7:37 am Post subject: Re: CCDT in JAVA |
|
|
 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 |
|
 |
kalam475 |
Posted: Wed Nov 09, 2016 7:43 am Post subject: |
|
|
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 |
|
 |
kalam475 |
Posted: Wed Nov 09, 2016 7:45 am Post subject: |
|
|
Acolyte
Joined: 16 Jan 2015 Posts: 63
|
without CCDT file I am able to connect normally by setting the MQEnvironment |
|
Back to top |
|
 |
Vitor |
Posted: Wed Nov 09, 2016 8:36 am Post subject: |
|
|
 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 |
|
 |
hughson |
Posted: Wed Nov 09, 2016 2:31 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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 |
|
 |
tczielke |
Posted: Wed Nov 09, 2016 6:33 pm Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 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 |
|
 |
kalam475 |
Posted: Wed Nov 09, 2016 11:36 pm Post subject: |
|
|
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 |
|
 |
hughson |
Posted: Thu Nov 10, 2016 1:14 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 Location: Bay of Plenty, New Zealand
|
|
Back to top |
|
 |
kalam475 |
Posted: Thu Nov 10, 2016 1:38 am Post subject: |
|
|
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 |
|
 |
hughson |
Posted: Thu Nov 10, 2016 2:26 am Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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 |
|
 |
kalam475 |
Posted: Thu Nov 10, 2016 3:14 am Post subject: |
|
|
Acolyte
Joined: 16 Jan 2015 Posts: 63
|
Now I am getting the error MQ Error - Reason code :2538 |
|
Back to top |
|
 |
hughson |
Posted: Thu Nov 10, 2016 1:22 pm Post subject: |
|
|
 Padawan
Joined: 09 May 2013 Posts: 1959 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 |
|
 |
RogerLacroix |
Posted: Thu Nov 10, 2016 4:33 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 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 |
|
 |
fjb_saper |
Posted: Fri Nov 11, 2016 5:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
|