Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting a Java app to MQSeries server using TCP/IP?

Status
Not open for further replies.

bzhang

Technical User
Jun 8, 2001
1
US
Hi,
I installed MQSeries server (v5.2) on Win 2000.
And I wrote a simple java application trying to connect to the MQSeries server, in IBM's documentation, there are two methods for the client to connect to the MQSeries server:
(1) Using JNDI interface
(2) using TCP/IP
Since I don't know anything about jndi, I chose using TCP/IP.
Following is the sample code from the IBM's redbook - "MQSeries using java':
///////////////////////////////////////////////////////////
private String HOSTNAME = "hostname";
private String QMGRNAME = "queuemanagername";
private String CHANNEL = "channelname";

private MQQueueManager qMgr;
private QueueConnectionFactory factory;
private QueueConnection connection;
factory = new com.ibm.mq.jms.MQQueueConnectionFactor();
factory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
factory.setQueueManager(QMGRNAME
factory.setHostName(HOSTNAME);
factory.setChannel(CHANNEL);
////////////////////////////////////////////////////////////
I am wondering what should be used for the host name, queue manager name etc? And how does this app find the queue manager created on the MQSeries sever? I tried using URL and ip address for the MQSeries server. But I got error:
//////////////////////////////////////////////////////
MQSample.java:29: cannot resolve symbol
symbol : method setQueueManager (java.lang.String)
location: interface javax.jms.QueueConnectionFactory
factory.setQueueManager(QMGRNAME);
^
MQSample.java:30: cannot resolve symbol
symbol : method setHostName (java.lang.String)
location: interface javax.jms.QueueConnectionFactory
factory.setHostName(HOSTNAME);
^
MQSample.java:31: cannot resolve symbol
symbol : method setChannel (java.lang.String)
location: interface javax.jms.QueueConnectionFactory
factory.setChannel(CHANNEL);
/////////////////////////////////////////////////////
Anyone used TCP/IP as the connection method for JMS MQSeries?
Thanks a lot in advance.


Bin
email: bzhang@chicagosystemsgroup.com
 
I did the same thing you tried, but from a Unix box. In this network we have a unix box and a AS/400 box with MQSeries. I had someone creating a MQSeries queue manager, queue name, and queue channel in a AS/400 box.

I executed a similar piece of java code as yours, passing the ip address of the AS/400 box, plus the names for the qmanager, qname and qchannel and it worked pretty well.

Make sure that the environment from within your are running the Java code, the Classpath is pointing to (ie .. is your root path directory) as ../mqm/lib where all the jar files are located.

Perhaps this may help or point to the proper direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top