|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Help!!! (MQJMS1058: not valid message property name ) |
« View previous topic :: View next topic » |
Author |
Message
|
mqwf1 |
Posted: Sat Jan 19, 2002 6:09 am Post subject: |
|
|
Novice
Joined: 13 Jan 2002 Posts: 22
|
source :
=============================================
import javax.jms.*; /* import of Sun's JMS interface */
/* Imports for MQSeries specific objects */
import com.ibm.mq.MQC;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnectionFactory; /* import to allow program */
/* to bypass JNDI lookup */
public class mqjmsro {
public static String QMGR = "FMCQM";
public static final String QUEUE = "REPLYQ" ;
public static void main( String[] args )
{
String outString = "Test message from mqjmsro";
Queue ioQueue = null;
QueueSession session = null;
QueueConnection connection = null;
QueueConnectionFactory factory = null;
System.out.println("mqjmsro sample program");
/********************************************************/
/* Process command-line arguments looking for qmgr name */
/********************************************************/
for ( int i=0; i<args.length; i++ ) {
String arg = args[i].toLowerCase();
if( arg.equals("-m") ) {
if (i+1< args.length) {
QMGR = args[++i];
} else {
System.out.println("Ignoring -m flag; no value supplied");
}
} else
// Report and discard any unknown command-line options
System.out.println("Ignoring unknown flag: " + arg );
}
try {
/****************************************************/
/* Create the connection factory directly from qmgr */
/****************************************************/
System.out.println(" creating QueueConnectionFactory");
factory = new MQQueueConnectionFactory();
((MQQueueConnectionFactory)factory).setQueueManager(QMGR);
/****************************************************/
/* Create the connection. Note: Receive calls will */
/* be blocked if the connection is not explicityly */
/* started. */
/****************************************************/
System.out.println(" creating connection");
connection = factory.createQueueConnection();
System.out.println(" starting connection");
connection.start();
/**************************************************/
/* Create a session that won't be transacted and */
/* that should automatically acknowledge received */
/* messages. */
/**************************************************/
System.out.println(" creating session");
boolean transacted = false;
session = connection.createQueueSession( transacted,
Session.AUTO_ACKNOWLEDGE);
/**********************************************/
/* Create a queue using the MQSeries specific */
/* queue name. */
/**********************************************/
ioQueue = session.createQueue( QUEUE );
/**********************************************/
/* Use the session to create a QueueSender by */
/* passing in the destination parameter. */
/**********************************************/
System.out.println(" creating a QueueSender");
QueueSender queueSender = session.createSender(ioQueue);
/***************************************************/
/* Create an empty message and put our text in it. */
/***************************************************/
System.out.println( " creating the message" );
TextMessage outMessage = session.createTextMessage();
outMessage.setText(outString);
/******************************************************/
/* In order to get a report exception, MQSeries must */
/* be given a destination for it. The following code */
/* will set the destination to be the queue manager */
/* and queue where the message is being sent. This */
/* would normally not be done but is being done here */
/* for convenience. */
/******************************************************/
MQQueue replyToQ = new MQQueue(QMGR,QUEUE);
Destination replyTo = (Destination) replyToQ;
outMessage.setJMSReplyTo(replyTo);
System.out.println(" setting Report property");
outMessage.setIntProperty("JMS_IBM_Report_Exception",
MQC.MQRO_EXCEPTION_WITH_DATA);
//should be put in MQMD header!!!
//outMessage.setStringProperty("JMSXUserID","1"); //exception jms1058
outMessage.setStringProperty("JMSXAppID","lad");
//info below will put in MQRFH2 header
outMessage.setStringProperty("JMSXGroupID","FMCGRP"); //JMSXUserID
outMessage.setStringProperty("x2D","1");
/*********************************/
/* Send the message to the queue */
/*********************************/
System.out.println( " sending message to " + ioQueue.getQueueName() );
queueSender.send(outMessage);
/***********************************/
/* Program is done, close objects. */
/***********************************/
System.out.println(" closing queue");
queueSender.close();
System.out.println(" closing session");
session.close();
session = null;
System.out.println(" closing connection");
connection.close();
connection = null;
} catch( JMSException je ) {
System.out.println("Caught JMSException: " + je);
Exception le = je.getLinkedException();
if (le != null) System.out.println("linked exception: " + le);
} catch( Exception e ) {
System.out.println("Caught exception: " + e );
} finally {
/*****************************************************/
/* We'll use a finally block to ensure that the most */
/* important JMS objects were closed. */
/*****************************************************/
try {
if (session != null) {
System.out.println(" closing session");
session.close();
}
if (connection != null) {
System.out.println(" closing connection");
connection.close();
}
} catch (JMSException je) {
System.out.println("Caught exception: "+je);
}
}
System.out.println("mqjmsro ending...");
}
}
=============================================
run infomation:
D:eccmqjmsro.java.tar>java mqjmsro
mqjmsro sample program
creating QueueConnectionFactory
creating connection
starting connection
creating session
creating a QueueSender
creating the message
setting Report property
Caught JMSException: javax.jms.MessageFormatException: MQJMS1058: not valid message property name JMSXAppID
closing session
closing connection
mqjmsro ending... |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|