Author |
Message
|
akii |
Posted: Tue Sep 12, 2006 9:49 pm Post subject: MQ recevie error |
|
|
Newbie
Joined: 12 Sep 2006 Posts: 3
|
I have write scheduler to get the MQ Q message.
the back console print:
A WebSphere MQ error occurred : Completion code 2 Reason Code is 2058
A WebSphere MQ error occurred : Completion code 2 Reason Code is 2019
,but the Msg has received from the Q normally.why?  |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 13, 2006 1:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It is probably caused by your code. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
akii |
Posted: Wed Sep 13, 2006 1:57 am Post subject: |
|
|
Newbie
Joined: 12 Sep 2006 Posts: 3
|
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: BepsMbfeMqReceiverScheduler.java
package com.ncs.sh.beps.engine.scheduler;
import com.ibm.mq.*;
import com.ncs.sh.beps.common.mbfemsg.BepsMbfeMsg;
import com.ncs.sh.beps.common.system.BepsRecMbfeMsgCtl;
import com.ncs.sh.beps.common.util.BepsHelper;
import com.ncs.sh.beps.common.util.BepsIncomingStatusManager;
import com.ncs.sh.common.engine.NcsAbstractScheduler;
import com.ncs.sh.common.engine.NcsEngineController;
import com.ncs.sh.common.ibatis.NcsIbatisSqlMapClient;
import com.ncs.sh.common.util.NcsLogger;
import com.ncs.sh.common.util.NcsRuntimeException;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class BepsMbfeMqReceiverScheduler extends NcsAbstractScheduler
{
int receiveNum;
private String qManager;
private MQQueueManager qMgr;
private MQQueue qQueue;
private MQQueue qResponse;
private String msgText;
private String branchID;
public BepsMbfeMqReceiverScheduler()
{
receiveNum = 0;
}
public void onTime()
{
init();
GetMsg();
finalizer();
}
public void init()
{
ArrayList list = new ArrayList();
StringTokenizer st;
if(getParameter() == null)
st = new StringTokenizer("2000|5000|BEI|192.168.88.164|1414|QM_mengzhaojun|testResend|1381", "|");
else
st = new StringTokenizer(getParameter(), "|");
list.clear();
for(; st.hasMoreTokens(); list.add(st.nextToken()));
branchID = (String)list.get(2);
String HOST_NAME = (String)list.get(3);
int PORT = Integer.parseInt((String)list.get(4));
qManager = (String)list.get(5);
String Q_NAME = (String)list.get(6);
String Q_RESPONSE = (String)list.get(7);
int intCCSID = Integer.parseInt((String)list.get( );
try
{
MQException.log = null;
MQEnvironment.hostname = HOST_NAME;
MQEnvironment.port = PORT;
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.CCSID = intCCSID;
qMgr = new MQQueueManager(qManager);
int qOptioin = 17;
qQueue = qMgr.accessQueue(Q_NAME, qOptioin);
qOptioin = 48;
qResponse = qMgr.accessQueue(Q_RESPONSE, qOptioin);
}
catch(MQException e)
{
System.out.println("A WebSphere MQ error occurred : Completion code " + e.completionCode + " Reason Code is " + e.reasonCode);
e.getMessage();
}
}
private int getLength(byte s[])
{
ByteBuffer b = ByteBuffer.wrap(s);
b.order(ByteOrder.LITTLE_ENDIAN);
return b.getInt();
}
public void GetMsg()
{
try
{
MQMessage retrievedMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions();
qQueue.get(retrievedMessage, gmo);
int length = retrievedMessage.getDataLength();
byte msg[] = new byte[length];
retrievedMessage.readFully(msg);
retrieveData(msg);
commit();
NcsLogger.info(getClass(), "The message is " + new String(msg, "GBK"));
receiveNum = 0;
}
catch(RuntimeException e)
{
backOut();
receiveNum++;
System.out.println("==================================================================" + receiveNum);
}
catch(MQException e)
{
if(e.reasonCode != 2033)
System.out.println("A WebSphere MQ error occurred : Completion code " + e.completionCode + " Reason Code is " + e.reasonCode);
}
catch(IOException e)
{
System.out.println("An error occurred whilst to the message buffer " + e);
}
}
public void SendMsg(byte qByte[])
{
try
{
MQMessage qMsg = new MQMessage();
qMsg.write(qByte);
MQPutMessageOptions pmo = new MQPutMessageOptions();
qResponse.put(qMsg, pmo);
NcsLogger.info(getClass(), "The message is sent!");
}
catch(MQException e)
{
backOut();
System.out.println("A WebSphere MQ error occurred : Completion code " + e.completionCode + " Reason Code is " + e.reasonCode);
throw new NcsRuntimeException(e);
}
catch(Exception e)
{
backOut();
e.printStackTrace();
throw new NcsRuntimeException(e);
}
}
public void finalizer()
{
try
{
qQueue.close();
qResponse.close();
qMgr.disconnect();
}
catch(MQException e)
{
System.out.println("A WebSphere MQ error occurred : Completion code " + e.completionCode + " Reason Code is " + e.reasonCode);
}
}
public void backOut()
{
try
{
NcsLogger.info(getClass(), "MQ rollbackI");
qMgr.backout();
}
catch(Exception e)
{
e.printStackTrace();
throw new NcsRuntimeException(e);
}
}
public void commit()
{
try
{
NcsLogger.info(getClass(), "MQ commitI");
qMgr.commit();
}
catch(Exception e)
{
e.printStackTrace();
throw new NcsRuntimeException(e);
}
}
public void retrieveData(byte recData[])
{
getEngine().getSqlMap().startTransaction();
try
{
BepsRecMbfeMsgCtl msgCtl = new BepsRecMbfeMsgCtl();
BepsMbfeMsg msg = new BepsMbfeMsg();
BepsIncomingStatusManager.bepsReceivedMbfeMsg(msg);
String header = BepsHelper.convertToGBK(BepsHelper.subBytes(recData, 0, ).trim();
recData = BepsHelper.subBytes(recData, ;
String strMsgCode = BepsHelper.convertToGBK(BepsHelper.subBytes(recData, 57, 3));
if(header.equals("URPS_417"))
strMsgCode = "417";
else
msg.setMsgSeqNo(Integer.parseInt(BepsHelper.convertToGBK(BepsHelper.subBytes(recData, 15, ).trim()));
msg.setMsgCode(strMsgCode);
msgCtl.setMsgCode(strMsgCode);
msgCtl.setBranchId(branchID);
msgCtl = msgCtl.selectByBranchAndMsgCode(getEngine().getSqlMap());
if(msgCtl != null)
msg.setProcessType(msgCtl.getProcessType());
else
msg.setProcessType("N");
msg.setBranchId(branchID);
msg.setCreateBy("BEPSBACKENGINE");
msg.setModifyBy("BEPSBACKENGINE");
msg.insertIntoDB(getEngine().getSqlMap());
msg.setMsg(recData);
msg.updateBinaryByPk(getEngine().getSqlMap());
SendMsg("0".getBytes());
}
catch(RuntimeException e)
{
SendMsg("1".getBytes());
e.printStackTrace();
throw new RuntimeException(e);
}
finally
{
getEngine().getSqlMap().commitTransaction();
getEngine().getSqlMap().endTransaction();
}
return;
}
public static void main(String args1[])
{
}
} |
|
Back to top |
|
 |
Nigelg |
Posted: Wed Sep 13, 2006 3:46 am Post subject: |
|
|
Grand Master
Joined: 02 Aug 2004 Posts: 1046
|
Yes, that is definitely java code. I recommend that you read through it to find the problem. _________________ MQSeries.net helps those who help themselves.. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 13, 2006 3:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I don't understand.
If you are writing this scheduler, then why did you need to decompile it?
I hope that the original author of this code doesn't mind you decompiling it and placing it on a public forum. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
vennela |
Posted: Wed Sep 13, 2006 12:57 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Also, you can search the forum for 2058 and 2019 and you should get lot of results |
|
Back to top |
|
 |
akii |
Posted: Wed Sep 13, 2006 6:22 pm Post subject: |
|
|
Newbie
Joined: 12 Sep 2006 Posts: 3
|
jefflowrey wrote: |
I don't understand.
If you are writing this scheduler, then why did you need to decompile it?
I hope that the original author of this code doesn't mind you decompiling it and placing it on a public forum. |
because my source is in the company and I have the jar on the my customer side,so i decompile it. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 14, 2006 1:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I still don't understand how you can be developing code without access to the actual source code. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|