Hi,
I am trying to connect to the remote Queue manager from NT box using MQSeries 5.2 using java.
when I tried to run my java program its throwing me this error
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 22
MQJE001: Completion Code 2. Reason 2009
Can some one help me on this error
Here is my sample code I tried to connect to remote machine.
import com.ibm.mq.*;
public class Send1
{
public static String hostname = "remote host name";
public static String channel = "channal name";
public static String qManager = "locan qmanager name" ;
public static String queue = "queue name";
public static MQQueueManager qMgr;
public static void main(String args[]) {
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
try {
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_OUTPUT ;
MQQueue system_default_local_queue = qMgr.accessQueue(queue ,openOptions);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!" ) ;
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(hello_world,pmo);
system_default_local_queue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
System.out.println("An MQ error occurred : Completion code " +
ex.completionCode +
" Reason code " + ex.reasonCode);
}
catch (java.io.IOException e)
{
System.out.println("An error occurred while writing to the message buffer: " + e );
}
}
}
Anything wrong on this code?
I am trying to connect to the remote Queue manager from NT box using MQSeries 5.2 using java.
when I tried to run my java program its throwing me this error
MQJE016: MQ queue manager closed channel immediately during connect
Closure reason = 22
MQJE001: Completion Code 2. Reason 2009
Can some one help me on this error
Here is my sample code I tried to connect to remote machine.
import com.ibm.mq.*;
public class Send1
{
public static String hostname = "remote host name";
public static String channel = "channal name";
public static String qManager = "locan qmanager name" ;
public static String queue = "queue name";
public static MQQueueManager qMgr;
public static void main(String args[]) {
MQEnvironment.hostname = hostname;
MQEnvironment.channel = channel;
try {
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_OUTPUT ;
MQQueue system_default_local_queue = qMgr.accessQueue(queue ,openOptions);
MQMessage hello_world = new MQMessage();
hello_world.writeUTF("Hello World!" ) ;
MQPutMessageOptions pmo = new MQPutMessageOptions();
system_default_local_queue.put(hello_world,pmo);
system_default_local_queue.close();
qMgr.disconnect();
}
catch (MQException ex)
{
System.out.println("An MQ error occurred : Completion code " +
ex.completionCode +
" Reason code " + ex.reasonCode);
}
catch (java.io.IOException e)
{
System.out.println("An error occurred while writing to the message buffer: " + e );
}
}
}
Anything wrong on this code?