Author |
Message
|
hilltops |
Posted: Wed Sep 13, 2006 7:42 am Post subject: Channel definition tables with MQ 6.0 for java application |
|
|
Centurion
Joined: 01 Mar 2006 Posts: 112
|
I am having problems connecting to a queue manager from an MQ client application written in Java. The MQI channel is defined using a channel definition table. I am not using any environment variables but point to the location of the channel definition table using the url object as in;
chldefurl = new URL("file://home/mqm/AMQCLCHL.TAB");
I then build the queue manager object using thus object;
MQQueueManager qMgr = new MQQueueManager("TEST", chldefurl);
The channels are defined on the queue manager TEST as;
DEFINE CHANNEL(SVRCONN.TEST) CHLTYPE(SVRCONN) TRPTYPE(TCP) +
DESCR('Server connection on queue manager TEST') +
replace
DEFINE CHANNEL(SVRCONN.TEST) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
DESCR('Client connection to queue manager TEST') +
CONNAME('abcdefgh.SYSTEMS.UK.XXXX(15003)') +
QMNAME(TEST) +
REPLACE
And I have copied the channel def table for its default location to home/mqm/AMQCLCHL.TAB.
When I run the application I get 2278 (MQRC_CLIENT_CONN_ERROR). Anyone had this problem.
Thanx
The Sample code follows;
###############################################
import com.ibm.mq.*;
import java.net.*;
public class SSLSample2 {
// define the parms
private static String conname ;
private static String port ;
private static String channel ;
private static String qmgr ;
private static String sslciph ;
private static String sslkeyr ;
private static String sslpass ;
private MQQueue reqQueue;
private String reqQName = "TEST.QUEUE";
public static void main(String args[]) {
new SSLSample2().runSample();
}
public void runSample() {
try {
java.net.URL chldefurl = null;
try{
chldefurl = new URL("file://home/mqm/AMQCLCHL.TAB");
}
catch(Exception e){
System.out.println("Malformed URL...Quiting");
System.exit(1);
}
MQQueueManager qMgr = new MQQueueManager("TEST", chldefurl);
int openOptions = MQC.MQOO_OUTPUT ;
reqQueue = qMgr.accessQueue(reqQName, openOptions);
MQMessage myMessage = new MQMessage();
myMessage.writeUTF("Testing");
MQPutMessageOptions pmo = new MQPutMessageOptions();
reqQueue.put(myMessage,pmo);
System.out.println("Connection successful!");
try{
System.out.println("Hold connection open for 60s. Go check that the SVRCONN is running!");
Thread.sleep(60000);
}
catch(Exception e){
}
System.out.println("Disconnecting from the Queue Manager");
qMgr.disconnect();
System.out.println("Done!");
}
catch (Exception ex) {
System.out.println("A WebSphere MQ Error occured : ..................");
ex.printStackTrace();
}
}
}
############################################### |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 13, 2006 7:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You need to specify the QM name on the CLNTCONN. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
hilltops |
Posted: Wed Sep 13, 2006 7:53 am Post subject: |
|
|
Centurion
Joined: 01 Mar 2006 Posts: 112
|
The queue manager is specified as TEST as follows;
DEFINE CHANNEL(SVRCONN.TEST) CHLTYPE(CLNTCONN) TRPTYPE(TCP) +
DESCR('Client connection to queue manager TEST') +
CONNAME('abcdefgh.SYSTEMS.UK.XXXX(15003)') +
QMNAME(TEST) +
REPLACE |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 13, 2006 7:54 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I was reading the SVRCONN definition. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 13, 2006 7:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay, let's try changing your URL to "file:///home/mqm/AMQCLCHL.TAB". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
hilltops |
Posted: Wed Sep 13, 2006 8:05 am Post subject: |
|
|
Centurion
Joined: 01 Mar 2006 Posts: 112
|
Setting the URL to "file:///home/mqm/AMQCLCHL.TAB" has worked.
Thanks |
|
Back to top |
|
 |
Hassan |
Posted: Wed Sep 13, 2006 8:43 am Post subject: |
|
|
 Voyager
Joined: 01 Apr 2004 Posts: 81 Location: Toronto, Canada
|
I have to ask .... why 3 slashes to get it to work? |
|
Back to top |
|
 |
wschutz |
Posted: Wed Sep 13, 2006 9:21 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
From RFC 1738:
Quote: |
3.10 FILES
The file URL scheme is used to designate files accessible on a
particular host computer. This scheme, unlike most other URL schemes,
does not designate a resource that is universally accessible over the
Internet.
A file URL takes the form:
file://<host>/<path>
where <host> is the fully qualified domain name of the system on
which the <path> is accessible, and <path> is a hierarchical
directory path of the form <directory>/<directory>/.../<name>.
For example, a VMS file
DISK$USER:[MY.NOTES]NOTE123456.TXT
might become
<URL:file://vms.host.edu/disk$user/my/notes/note12345.txt>
As a special case, <host> can be the string "localhost" or the empty
string; this is interpreted as `the machine from which the URL is
being interpreted'.
The file URL scheme is unusual in that it does not specify an
Internet protocol or access method for such files; as such, its
utility in network protocols between hosts is limited.
|
Since there is no <host>... its 3 /'s _________________ -wayne |
|
Back to top |
|
 |
Hassan |
Posted: Wed Sep 13, 2006 10:15 am Post subject: |
|
|
 Voyager
Joined: 01 Apr 2004 Posts: 81 Location: Toronto, Canada
|
Thanks Wayne.
Based on this is it safe to assume "file://localhost/home/mqm/AMQCLCHL.TAB"
would also work?
Rgds.
Hassan |
|
Back to top |
|
 |
wschutz |
Posted: Wed Sep 13, 2006 12:55 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Its never safe to assume .... but using "localhost" does work... I'm not sure what happens if you specify a foriegn host name however... iirc the doc does say you can specify ftp:// _________________ -wayne |
|
Back to top |
|
 |
Hassan |
Posted: Thu Sep 14, 2006 5:05 am Post subject: |
|
|
 Voyager
Joined: 01 Apr 2004 Posts: 81 Location: Toronto, Canada
|
Thanks Wayne ... point taken ... I just remembered what they say about assumption being the mother of all &%#@ ups so I'll test it out.
Cheers,
Hassan |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Sep 14, 2006 3:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Hassan wrote: |
Thanks Wayne ... point taken ... I just remembered what they say about assumption being the mother of all &%#@ ups so I'll test it out.
Cheers,
Hassan |
Steven Segal -- ???? --Dark Territories
And no I don't have a cell phone linked to a satellite dish...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Hassan |
Posted: Fri Sep 15, 2006 5:49 am Post subject: |
|
|
 Voyager
Joined: 01 Apr 2004 Posts: 81 Location: Toronto, Canada
|
Can't remember where I heard this but do remember the quote.
If you don't have a cell phone hooked upto a satellite, do you at least have sleek long hair which never get messed even when you stand on top of a speeding train and fight 20 bad guys?  |
|
Back to top |
|
 |
|