|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Help reqd in locating java exception raised in program |
« View previous topic :: View next topic » |
Author |
Message
|
manojg9 |
Posted: Mon Jul 23, 2007 3:04 am Post subject: Help reqd in locating java exception raised in program |
|
|
Newbie
Joined: 23 Jul 2007 Posts: 3
|
The below is the error :
2007-07-23 02:15:23,749 | INFO | [main] | root:info | Connecting to Queue Manager NYCGPOS_QM...
2007-07-23 02:15:24,345 | FATAL | [main] | root:fatal | Exception Logging Started
Module Name : Putting message on the queue
Exception Type : class java.lang.NullPointerException
At com.cititech.gpos.mq.service.CITIDEXMQMain.putDiscrResp(CITIDEXMQMain.java:666)
At com.cititech.gpos.dao.DAO824.insert824(DAO824.java:159)
At com.cititech.gpos.filedelivery.Populate824.processFrom824(Populate824.java:303)
At com.cititech.gpos.filedelivery.Populate824.process824(Populate824.java:255)
At com.cititech.gpos.filedelivery.Populate824.main(Populate824.java:203)
User Name :
Activity Message : Exception while Putting message on the queue
Parameter Info
No Parameter Information available for Exception class java.lang.NullPointerExceptionException Reason : null
Exception Logging Ended
2007-07-23 02:15:24,360 | FATAL | [main] | root:log | Exception@DAO824.insert824()
java.lang.NullPointerException
at com.cititech.gpos.mq.service.CITIDEXMQMain.putDiscrResp(CITIDEXMQMain.java:744)
at com.cititech.gpos.dao.DAO824.insert824(DAO824.java:159)
at com.cititech.gpos.filedelivery.Populate824.processFrom824(Populate824.java:303)
at com.cititech.gpos.filedelivery.Populate824.process824(Populate824.java:255)
at com.cititech.gpos.filedelivery.Populate824.main(Populate824.java:203)
Program is below :
package com.cititech.gpos.mq.service;
import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.*;
import com.cititech.ctsi.util.SecureXMLInit;
import com.cititech.gpos.bill.bean.BillBean;
import com.cititech.gpos.bill.bean.BillDiscrepancyResponseBean;
import com.cititech.gpos.dao.BillDiscrepancyResponseDAO;
import com.cititech.gpos.dao.DAO824;
import com.cititech.gpos.dao.LoanDAO;
import com.cititech.gpos.loan.bean.LoanBean;
import com.cititech.gpos.mq.utils.IMessageTag;
import com.cititech.gpos.service.GPOSTrippleDESDecryptor;
import com.cititech.gpos.utils.AuditDetails;
import com.cititech.gpos.utils.GPOSLogInfo;
import com.cititech.gpos.utils.GPOSLogger;
import com.ibm.mq.MQC;
import com.ibm.mq.MQException;
import com.ibm.mq.MQGetMessageOptions;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.MQXAQueueManager;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
public class CITIDEXMQMain {
public MQQueueManager qmgr;
private byte[] correlationId;
Connection conn = null;
MQXAQueueManager QueueManager;
TransactionManager mgr=null;
Transaction trans=null;
XAResource dbResource=null;
XAResource mqResource=null;
/**
* A reference to the Logging Service.
*/
protected static GPOSLogger als;
static {
als = GPOSLogger.getLoggerInstance();
//Following block will be executed only if database password is not set with SecureXMLInit
/*if(SecureXMLInit.getDbPasswordForMQ()==null||SecureXMLInit.getDbPasswordForMQ().equals(""))
{
GPOSTrippleDESDecryptor decryptor = new GPOSTrippleDESDecryptor();
String encFile = SecureXMLInit.getProperty("gpos.encrypt.file.for.mq");
String keyFile = SecureXMLInit.getProperty("gpos.key.file.for.mq");
String password = decryptor.decryptPassword(encFile,keyFile);
SecureXMLInit.setDbPasswordForMQ(password);
}*/
}
/**
* This initializes the interface and makes connections to the
* required resources. The parameters for connecting to the
* resources will be read from the application initialisation file.
*
* @throws MQException If the connection to back end MQ server is not
* established.
* @throws SQLException If the connection to database is not
* established.
*/
public void initialize() throws Exception
{
als.debug("MQInterface:initialize()");
try {
// 3.2.3 Start
/* Instead of preparing Initial context object from default jndi properties,
properties has been passes to initial context explicitly as shown below to avoid NoInitiaContextException
*/
Properties pr = new Properties();
pr.put(Context.INITIAL_CONTEXT_FACTORY,SecureXMLInit.getProperty("gpos.naming.contextfactory"));
pr.put(Context.PROVIDER_URL,SecureXMLInit.getProperty("gpos.contextprovider.url"));
Context ctx = new InitialContext(pr);
//Context ctx = new InitialContext();
// 3.2.3 End
//Performing JNDI look up for Jrun TransactionManager Implemenattion object which will act as a Transaction Manager
//and MQ and Oracle would act as a Resource Manager
mgr = (TransactionManager) ctx.lookup("DefaultDomain/TransactionManager");
//MQEnvironment.enableTracing(4,System.out);
String qManager = SecureXMLInit.getProperty("citidex.mq.qManager");
//Set up the MQEnvironment properties for Client Connections
als.info("Connecting to Queue Manager " + qManager + "...");
Hashtable mqProperies = new Hashtable();
mqProperies.put(MQC.THREAD_AFFINITY , new Boolean(true));
//qmgr = new MQQueueManager(qManager, mqProperies);
//Preparing MQ XA QueueManager Object which will take part in Global Transaction
QueueManager=new MQXAQueueManager(qManager,mqProperies);
qmgr = QueueManager.getQueueManager();
//qmgr = new MQQueueManager(qManager, mqProperies);
mqResource=QueueManager.getXAResource();
// Preparing XADatabaseSource Object which will take part in Global Transaction
oracle.jdbc.xa.client.OracleXADataSource xads = new oracle.jdbc.xa.client.OracleXADataSource();
xads.setURL(SecureXMLInit.getProperty("gpos.DB.url"));
xads.setUser(SecureXMLInit.getProperty("gpos.DB.username"));
String password = SecureXMLInit.getDbPassword();
xads.setPassword(password);
javax.sql.XAConnection conn1=xads.getXAConnection(SecureXMLInit.getProperty("gpos.DB.username"),password);
dbResource=conn1.getXAResource();
conn=conn1.getConnection();
}
catch(com.ibm.mq.MQException mqe) {
als.fatal("An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode );
als.fatal(mqe, mqe);
throw mqe;
}
catch(RuntimeException rex) {
System.out.println("RuntimeException in CITIDEXMQMain initialize() ");
rex.printStackTrace();
}
catch(Exception e) {
als.fatal(e, e);
throw e;
}
}
/*public CITIDEXMQMain(BillBean billBean) throws Exception
{
DAO824 dao = new DAO824();
dao.insertBillBean(billBean, true);
initialize();
}*/
public CITIDEXMQMain() throws Exception
{
initialize();
}
/**
* This puts the message to the back end MQ and executes the query on the database.
* This uses distributed transactions for performing these actions. The id of
* the message placed on MQ will be stored. This will be used to get the message
* from the back end MQ.
*
* @param str The message to be placed on the back end MQ.
* @param db The BaseTransaction object which has to be updated.
*
* @throws MQException If some problem occurs while placing the message on MQ.
* @throws SQLException If some problem occurs while executing the query.
*/
public void put(String str, BaseTransaction db) throws Exception
{
if( qmgr == null ) throw new Exception("securexml.ex.NOT_INITIALIZED");
if( (str == null) || (db == null) )
throw new Exception("No Data Available");
try {
//Begening Global Transaction
mgr.begin();
//Getting transaction associated to this context
trans=mgr.getTransaction();
//Enlisting the Resources taking part in global transaction
//i.e. Database and MQ
trans.enlistResource(mqResource);
trans.enlistResource(dbResource);
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE ;
String strPutQueue = SecureXMLInit.getProperty("citidex.mq.putqueue");
MQQueue putQueue = qmgr.accessQueue(strPutQueue, openOptions);
// Define a simple MQSeries message, and
//write some text in UTF format..
MQMessage message = new MQMessage();
//message.characterSet = 1208; // your EBCDIC encoding, default encoding is 819
//message.characterSet = 1200; // your EBCDIC encoding, default encoding is 819
message.format = MQC.MQFMT_STRING;
//message.format = "MQSTR";
message.writeString(str);
// specify the message options...
MQPutMessageOptions pmo =new MQPutMessageOptions();
pmo.options = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT;
putQueue.put(message,pmo);
als.log("Put message Id = " + message.messageId );
correlationId = message.messageId ;
db.setConnection(conn);
db.insert();
putQueue.close();
mgr.commit();
return;
}
catch(com.ibm.mq.MQException mqe) {
String reason="An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode;
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",mqe);
Hashtable param=new Hashtable();
param.put("Reason Code And Completion Code",reason);
logInfo.setData("","Exception while Putting message on the queue",param,mqe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw mqe;
}
catch(Exception sxe) {
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",sxe);
logInfo.setData("","Exception while Putting message on the queue",null,sxe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw sxe;
}
/* finally {
try {
if( qmgr != null ) {
qmgr.backout();
}
}
catch(com.ibm.mq.MQException mqe) {
String reason="An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode;
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Back out the queue",mqe);
Hashtable param=new Hashtable();
param.put("Reason Code And Completion Code",reason);
logInfo.setData("","Exception while Back out the queue ",param,mqe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
throw mqe;
}
}*/
}
/**
* Get the number of messages currently on the queue.
* This value is incremented during a put call, and during backout of a get call.
* It is decremented during a non-browse get and during backout of a put call.
*/
public int getCurrentDepth() throws Exception
{
if( qmgr == null ) throw new Exception("securexml.ex.NOT_INITIALIZED");
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INQUIRE ;
String strGetQueue = SecureXMLInit.getProperty("citidex.mq.getqueue");
MQQueue getQueue = qmgr.accessQueue(strGetQueue, openOptions);
int cnt=getQueue.getCurrentDepth();
getQueue.close();
return cnt;
}
/**
* This gets the message from the back end MQ and executes the query on the database.
* This uses distributed transactions for performing these actions. 'put' method
* should be called prior to calling this method. The id of the message placed on MQ
* earlier is used to get the message.
*
* @param db The BaseTransaction object which has to be updated.
*
* @return The message retrieved from the back end.
*
* @throws MQException If some problem occurs while getting the message on MQ.
* @throws SQLException If some problem occurs while executing the query.
*/
public String get(InTransaction db) throws Exception
{
als.debug("MQInterface:get(String)");
if( qmgr == null ) throw new Exception();
/*if( db == null ) throw new Exception();*/
boolean bErrorOccured = true;
try
{
mgr.begin();
trans=mgr.getTransaction();
trans.enlistResource(mqResource);
trans.enlistResource(dbResource);
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_FAIL_IF_QUIESCING ;
//int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_BROWSE ; // TEST
String strGetQueue = SecureXMLInit.getProperty("citidex.mq.getqueue");
MQQueue getQueue = qmgr.accessQueue(strGetQueue, openOptions);
// Define a simple MQSeries message, and
//write some text in UTF format..
MQMessage message = new MQMessage();
//message.characterSet = 1208;
message.correlationId = this.correlationId;
// specify the message options...
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT ;
// gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST ; // TEST
int waitInterval = Integer.parseInt(SecureXMLInit.getProperty("citidex.mq.waitperiod"));
// int waitInterval = 1000; // TEST
gmo.waitInterval = waitInterval;
getQueue.get(message,gmo);
int length = message.getMessageLength();
String strMessage = message.readString(length);
GPOSLogger.getLoggerInstance().log("Recieved Message = \n " + strMessage+ "\n");
ACKMessageProcessor messageProcessor = new ACKMessageProcessor(strMessage);
messageProcessor.process();
//update DB.
db.setConnection(conn);
String fileName = db.update(messageProcessor.getMessage());
if(fileName != null && ! fileName.equalsIgnoreCase(InTransaction.Update_Success))
{
InMessageProcessor inMessageProcessor = new InMessageProcessor();
String srcpath = SecureXMLInit.getProperty("citidex.messages.processdir");
File srcFile=new File(srcpath+fileName);
boolean result = inMessageProcessor.moveFile(srcFile,true,true);
if(! result)
{
als.log("CITIDEXMQMain : get : Problem in Moving Msg File From Processed dir to Success dir.");
mgr.rollback();
}
}
else if(fileName != null && fileName.equalsIgnoreCase(InTransaction.Update_Success))
{
als.log("CITIDEXMQMain : get : status updated successfully.");
}
else if(fileName != null && fileName.equalsIgnoreCase(InTransaction.Level_Unidentified))
{
als.log("Error Code : " + messageProcessor.getMessage().getPsgTxnStatus() +
" Recieved For Message With CDI Ref No : " + messageProcessor.getMessage().getPsgCDI() +
" Is Not Present In GPOS Static DataBase.");
}
else
{
String mesgType = messageProcessor.getMessage().getMessageType();
if(!mesgType.equalsIgnoreCase(IMessageTag.MESSAGE_TYPE_VALUE) &&
!mesgType.equalsIgnoreCase(IMessageTag.MESSAGE_MT43ER_VALUE) &&
!mesgType.equalsIgnoreCase(IMessageTag.MESSAGE_MT75AR_VALUE))
{
als.log("CITIDEXMQMain : get : Problem in Updating GI005 Status / Getting File Name.");
mgr.rollback();
}
}
getQueue.close(); //4.2.1 fix for amqzlaa0 issue
mgr.commit();
bErrorOccured = false;
return strMessage;
}
catch(com.ibm.mq.MQException mqe) {
//If no more messages in Queue is the error then dont write anything in
//log else write error details in log
if(mqe.reasonCode != MQException.MQRC_NO_MSG_AVAILABLE)
{
String reason="An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode;
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Getting message from the queue",mqe);
Hashtable param=new Hashtable();
param.put("Reason Code And Completion Code",reason);
logInfo.setData("","Exception while Getting message from the queue",param,mqe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
}
throw mqe;
}
catch(Exception sxe) {
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Getting message from the queue",sxe);
logInfo.setData("","Exception while Getting message from the queue",null,sxe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw sxe;
}
}
/**
* This closes the connection to the MQQueueManager and the connection to the database.
*
* @throws MQException If the connection to MQQueueManager is not closed.
* @throws DatabaseException If the connection to database is not closed.
*/
public void close() throws Exception
{
als.debug("MQInterface:close()");
try {
if( qmgr != null )
//qmgr.close();
qmgr.disconnect(); //4.2.1 fix for amqzlaa0 issue
if( ( conn != null ) && ( conn.isClosed() ) )
conn.close();
}
catch(com.ibm.mq.MQException mqe) {
als.fatal("An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode );
als.fatal(mqe, mqe);
throw mqe;
}
catch(java.sql.SQLException sqle) {
als.fatal(sqle, sqle);
throw sqle;
}
catch(java.lang.Exception e) {
als.fatal(e, e);
throw e;
}
}
/**
* @param string
* @param outTransaction
* @param loanBean
* @param auditDetails
*/
public void putLoan(String loanmsg, OutTransaction outTransaction, LoanBean loanBean,
AuditDetails auditDetails) throws Exception {
if( qmgr == null ) throw new Exception("securexml.ex.NOT_INITIALIZED");
if( (loanmsg == null) || (outTransaction == null) )
throw new Exception("No Data Available");
try {
mgr.begin();
trans=mgr.getTransaction();
trans.enlistResource(mqResource);
trans.enlistResource(dbResource);
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE ;
String strPutQueue = SecureXMLInit.getProperty("citidex.mq.putqueue");
MQQueue putQueue = qmgr.accessQueue(strPutQueue, openOptions);
// Define a simple MQSeries message, and
//write some text in UTF format..
MQMessage message = new MQMessage();
//message.characterSet = 1208; // your EBCDIC encoding, default encoding is 819
//message.characterSet = 1200; // your EBCDIC encoding, default encoding is 819
message.format = MQC.MQFMT_STRING;
//message.format = "MQSTR";
message.writeString(loanmsg);
als.log("message=\n" + loanmsg);
// specify the message options...
MQPutMessageOptions pmo =new MQPutMessageOptions();
pmo.options = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT;
putQueue.put(message,pmo);
als.log("Put message Id = " + message.messageId );
correlationId = message.messageId ;
outTransaction.setConnection(conn);
outTransaction.insertLoanMsg(loanBean);
LoanDAO loanDao = new LoanDAO();
loanDao.setConnection(conn);
loanBean.setTransactionStatus("A");
loanDao.authorizeLoan(loanBean,auditDetails,true);
putQueue.close();
mgr.commit();
return;
}
catch(com.ibm.mq.MQException mqe) {
String reason="An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode;
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",mqe);
Hashtable param=new Hashtable();
param.put("Reason Code And Completion Code",reason);
logInfo.setData("","Exception while Putting message on the queue",param,mqe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw mqe;
}
catch(Exception sxe) {
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",sxe);
logInfo.setData("","Exception while Putting message on the queue",null,sxe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw sxe;
}
}
public void putDiscrResp(String loanmsg, OutTransaction outTransaction,
BillDiscrepancyResponseBean billDiscrepancyResponseBean, BillBean billBean) throws Exception {
if( qmgr == null ) throw new Exception("securexml.ex.NOT_INITIALIZED");
if( (loanmsg == null) || (outTransaction == null) )
throw new Exception("No Data Available");
try {
mgr.begin();
trans=mgr.getTransaction();
trans.enlistResource(mqResource);
trans.enlistResource(dbResource);
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE ;
String strPutQueue = SecureXMLInit.getProperty("citidex.mq.putqueue");
MQQueue putQueue = qmgr.accessQueue(strPutQueue, openOptions);
// Define a simple MQSeries message, and
//write some text in UTF format..
MQMessage message = new MQMessage();
//message.characterSet = 1208; // your EBCDIC encoding, default encoding is 819
//message.characterSet = 1200; // your EBCDIC encoding, default encoding is 819
message.format = MQC.MQFMT_STRING;
//message.format = "MQSTR";
message.writeString(loanmsg);
als.log("message=\n" + loanmsg);
// specify the message options...
MQPutMessageOptions pmo =new MQPutMessageOptions();
pmo.options = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT;
putQueue.put(message,pmo);
als.log("Put message Id = " + message.messageId );
correlationId = message.messageId ;
outTransaction.setConnection(conn);
outTransaction.insertDiscrMsg(billDiscrepancyResponseBean);
billDiscrepancyResponseBean.setTransactionStatus("A");
BillDiscrepancyResponseDAO dao = new BillDiscrepancyResponseDAO();
dao.setConnection(conn);
dao.authoriseBillDiscrepancyResponse(billDiscrepancyResponseBean, billBean, true);
putQueue.close();
mgr.commit();
return;
}
catch(com.ibm.mq.MQException mqe) {
String reason="An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode;
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",mqe);
Hashtable param=new Hashtable();
param.put("Reason Code And Completion Code",reason);
logInfo.setData("","Exception while Putting message on the queue",param,mqe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw mqe;
}
catch(Exception sxe) {
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",sxe);
logInfo.setData("","Exception while Putting message on the queue",null,sxe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw sxe;
}
}
public void putDiscrResp(BillBean billBean) throws Exception {
if( qmgr == null ) throw new Exception("securexml.ex.NOT_INITIALIZED");
/*if( (loanmsg == null) || (outTransaction == null) )
throw new Exception("No Data Available");
*/
try {
mgr.begin();
trans=mgr.getTransaction();
trans.enlistResource(mqResource);
trans.enlistResource(dbResource);
DAO824 dao = new DAO824();
dao.setConnection(conn);
dao.insertBillBean(billBean, true);
String discrMsg = billBean.getMtMessage();
if( (discrMsg == null) || (discrMsg.equals("")) )
throw new Exception("No Data Available");
OutMessageProcessor process = new OutMessageProcessor();
CITIDEXRequestMessage requestMessage =
(CITIDEXRequestMessage) process.createRequestMessage(new StringBuffer(discrMsg));
OutTransaction outTransaction = new OutTransaction();
outTransaction.setResendFlag(false);
outTransaction.setCDI(requestMessage.getCDI());
outTransaction.setMessageType(requestMessage.getMessageType());
int openOptions = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_OUTPUT | MQC.MQOO_INQUIRE ;
String strPutQueue = SecureXMLInit.getProperty("citidex.mq.putqueue");
MQQueue putQueue = qmgr.accessQueue(strPutQueue, openOptions);
// Define a simple MQSeries message, and
//write some text in UTF format..
MQMessage message = new MQMessage();
//message.characterSet = 1208; // your EBCDIC encoding, default encoding is 819
//message.characterSet = 1200; // your EBCDIC encoding, default encoding is 819
message.format = MQC.MQFMT_STRING;
//message.format = "MQSTR";
message.writeString(requestMessage.getData().toString());
als.log("message=\n" + requestMessage.getData().toString());
// specify the message options...
MQPutMessageOptions pmo =new MQPutMessageOptions();
pmo.options = MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQGMO_SYNCPOINT;
putQueue.put(message,pmo);
als.log("Put message Id = " + message.messageId );
correlationId = message.messageId ;
outTransaction.setConnection(conn);
outTransaction.insertDiscrMsg(billBean);
//billBean.setTransactionStatus("A");
putQueue.close();
mgr.commit();
return;
}
catch(com.ibm.mq.MQException mqe) {
String reason="An MQ error occurred : Completion code " + mqe.completionCode
+ " Reason code " + mqe.reasonCode;
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",mqe);
Hashtable param=new Hashtable();
param.put("Reason Code And Completion Code",reason);
logInfo.setData("","Exception while Putting message on the queue",param,mqe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw mqe;
}
catch(Exception sxe) {
GPOSLogInfo logInfo = new GPOSLogInfo();
logInfo.setHeader("Putting message on the queue",sxe);
logInfo.setData("","Exception while Putting message on the queue",null,sxe.getMessage());
GPOSLogger.getLoggerInstance().fatal(logInfo);
mgr.rollback();
throw sxe;
}
}
} |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jul 23, 2007 3:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You are using a java base coding in a J2EE environment. Get with the program. Either use JMS or upgrade to Version 6.0.2.1 and use JCA.
This will make things much easier for you and allow the automatic coordination through the J2EE transaction manager.
For JBoss you really need JCA as otherwise the only supported J2EE transaction managers are BEA Weblogic and IBM WebSphere Application Server.
Have fun.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 23, 2007 3:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Which one is line 666?
Which object being accessed on line 666 could be null? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
manojg9 |
Posted: Mon Jul 23, 2007 3:35 am Post subject: |
|
|
Newbie
Joined: 23 Jul 2007 Posts: 3
|
Line 666 is :
mgr.begin(); |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jul 23, 2007 3:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So is mgr NULL there? How do you know for sure? _________________ I am *not* the model of the modern major general. |
|
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
|
|
|
|