ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » Workflow Engines - IBM MQ Workflow & Business Process Choreographer » [solved]ResourceException

Post new topic  Reply to topic
 [solved]ResourceException « View previous topic :: View next topic » 
Author Message
WSMQWorkflow
PostPosted: Wed Feb 25, 2004 2:02 pm    Post subject: [solved]ResourceException Reply with quote

Novice

Joined: 25 Feb 2004
Posts: 12

Hello all
I am trying to instantiate a process by putting an XML message through a java program on EXEXMLINPUTQ, my queue manager being FMCQM. I am using the sample program provided in the repository on the site and changed it according to my business process model.

When I am running the program

package workflow.test;
import java.io.*;
import java.util.*;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.*;

/**
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class StartProcessJMS {


////////////////////////////////////////////////////////////////////////////////
// This program sends an XML message to create and start a process instance //
// //
// //
// Note: Before executing this program, the FDL should be imported into the //
// runtime. //
// //
// You must specify <XMLInputQueue> and <MQWF QMGR> //
////////////////////////////////////////////////////////////////////////////////




private static final String INAMETAG = "<ProcInstName>";
private static final String STATETAG = "<ProcInstState>";
private static final String TIMETAG = "<LastStateChangeTime>";
private static final String ENDTAG = "</";

/** Creates a new instance of ProcessTemplateCreateAndStartInstance */
public StartProcessJMS() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
String WorkFlowQMGR = null;
String UPESQueue = null;
String ReplyQMGR = null;
String ReplyQueue = null;
boolean responseRequired = false;
if ( args.length != 4 &&
args.length != 2) {
System.out.println("Paramters are: Queue, QueueManager, ReplyQMGR, ReplyQueue");
System.out.println("Note that ReplyQMGR and ReplyQueue are OPTIONAL " +
"And if one is specified BOTH must be specified");
System.exit(-1);
}
UPESQueue = args[0];
WorkFlowQMGR = args[1];
if (args.length > 2) {
responseRequired = true;
ReplyQMGR = args[2];
ReplyQueue = args[3];
}
System.out.println("WorkFlowQMGR: " + WorkFlowQMGR);
System.out.println("UPESQueue: " + UPESQueue);
if (responseRequired) {
System.out.println("Response is required. Qmgr is " + ReplyQMGR);
System.out.println(" Queue is " + ReplyQueue);
}
System.out.println("Hello1");
MQQueueManager qmgr = new MQQueueManager(WorkFlowQMGR ) ;
System.out.println("Connected to QMGR " + WorkFlowQMGR);
System.out.println("Hello2");

int openOptions = MQC.MQOO_OUTPUT | MQC.MQOO_FAIL_IF_QUIESCING |
MQC.MQOO_SET_IDENTITY_CONTEXT;

MQQueue queue = qmgr.accessQueue(UPESQueue, openOptions,
null, null, "ADMIN");
System.out.println("Hello");
String DEFAULT_MQUSERID = "ADMIN";
MQMessage inMsg = new MQMessage();
String MessageInXMLFmt;
inMsg.userId = DEFAULT_MQUSERID;
if (responseRequired) {
inMsg.replyToQueueManagerName = ReplyQMGR;
inMsg.replyToQueueName = ReplyQueue;
}
MessageInXMLFmt = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + "<!-- This document is to create and start a process template -->" + "\n";
MessageInXMLFmt = MessageInXMLFmt + "<WfMessage>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <WfMessageHeader>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ResponseRequired>Yes</ResponseRequired>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <UserContext>I want this data back</UserContext>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </WfMessageHeader>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcessTemplateCreateAndStartInstance>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcTemplName>NApprovalRequest</ProcTemplName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcInstName>MyNApprovalRequest</ProcInstName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <KeepName>false</KeepName>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ProcInstInputData>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <lRequest>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <ApproverId>"+ 123 +"</ApproverId>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " <Organization>HR_DEPT</Organization>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </lRequest>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </ProcInstInputData>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + " </ProcessTemplateCreateAndStartInstance>" + "\n";
MessageInXMLFmt = MessageInXMLFmt + "</WfMessage>" + "\n";


inMsg.writeString(MessageInXMLFmt);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_SET_IDENTITY_CONTEXT;
queue.put(inMsg, pmo);
System.out.println("Start message sent");
qmgr.disconnect() ;
if (responseRequired) {
MQQueueManager replyQM = new MQQueueManager(ReplyQMGR);
System.out.println("ReplyQMGR accessed");
int ReplyOpenOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE ;
MQQueue replyQueue = replyQM.accessQueue(ReplyQueue,
ReplyOpenOptions, null, null, null);
System.out.println("ReplyQueue accessed");
MQMessage currentMessage = new MQMessage();
MQGetMessageOptions gmo = new MQGetMessageOptions( );
gmo.options = MQC.MQGMO_WAIT;
gmo.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
gmo.waitInterval = -1;
replyQueue.get( currentMessage, gmo );
byte buffer[] = new byte[ currentMessage.getDataLength() ];
currentMessage.readFully( buffer, 0, currentMessage.getDataLength() );
String curMsg = new String(buffer);
if ( curMsg.indexOf("<Exception>") != -1 )
System.out.println("An Error has occurred during Process Start\n" +
curMsg);
else {
int inamePos = curMsg.indexOf(INAMETAG) + INAMETAG.length() ;
int statePos = curMsg.indexOf(STATETAG) + STATETAG.length();
int timePos = curMsg.indexOf(TIMETAG) + TIMETAG.length();

String PIName = new String( curMsg.substring( inamePos ,
curMsg.indexOf(ENDTAG,inamePos) ) );
String PIState = new String( curMsg.substring( statePos,
curMsg.indexOf(ENDTAG,statePos) ) );
String PITime = new String( curMsg.substring( timePos,
curMsg.indexOf(ENDTAG,timePos) ) );
System.out.println("Instance '" + PIName +
"' is in the " + PIState + " state as of " + PITime);
}

replyQM.disconnect();
}

}
catch(MQException ex){
System.out.println("MQ Error - Reason code :" + ex.reasonCode);
}
catch (Exception e){
System.out.println("Error : " + e);

}
} // end main

} // end CLASS






the following error occurs.

WorkFlowQMGR: FMCQM
UPESQueue: EXEXMLINPUTQ
Hello1
java.lang.NoClassDefFoundError: javax/resource/ResourceException
at workflow.test.StartProcessJMS.main(StartProcessJMS.java:71)
Exception in thread "main"



This is happening at
MQQueueManager qmgr= new MQQueueManager(WorkFlowQMGR);

Why is it throwing the ResourceException ? My QMGR is up and running. Platform windowsxp/workflow 3.4. If anybody can help me out, i would really appreciate it.

Thanks in advance


Last edited by WSMQWorkflow on Thu Feb 26, 2004 3:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
jmac
PostPosted: Wed Feb 25, 2004 3:10 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Jun 2001
Posts: 3081
Location: EmeriCon, LLC

I believe you are missing connector.jar from your classpath
_________________
John McDonald
RETIRED
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
WSMQWorkflow
PostPosted: Wed Feb 25, 2004 3:45 pm    Post subject: Reply with quote

Novice

Joined: 25 Feb 2004
Posts: 12

John
you r right. But now I am facing the following problem. Could you tell me what all jar files I need to have in my class path, so that this program runs.


WorkFlowQMGR: FMCQM
UPESQueue: EXEXMLINPUTQ
Hello1
java.lang.NoClassDefFoundError: javax/transaction/xa/XAException
at com.ibm.mq.MQSESSIONServer.getMQSESSION(MQSESSIONServer.java:67)
at com.ibm.mq.MQSESSION.getSession(MQSESSION.java:363)
at com.ibm.mq.MQManagedConnectionJ11.<init>(MQManagedConnectionJ11.java:150)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11._createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:141)
at com.ibm.mq.MQBindingsManagedConnectionFactoryJ11.createManagedConnection(MQBindingsManagedConnectionFactoryJ11.java:159)
at com.ibm.mq.StoredManagedConnection.<init>(StoredManagedConnection.java:80)
at com.ibm.mq.MQSimpleConnectionManager.allocateConnection(MQSimpleConnectionManager.java:150)
at com.ibm.mq.MQQueueManager.obtainBaseMQQueueManager(MQQueueManager.java:682)
at com.ibm.mq.MQQueueManager.construct(MQQueueManager.java:620)
at com.ibm.mq.MQQueueManager.<init>(MQQueueManager.java:393)
at workflow.test.StartProcessJMS.main(StartProcessJMS.java:71)
Exception in thread "main"


Thanks in Advance
Back to top
View user's profile Send private message
jmac
PostPosted: Wed Feb 25, 2004 3:54 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Jun 2001
Posts: 3081
Location: EmeriCon, LLC

I am an old man so don't expect me to get all these right

But I know that one is jta.jar, and I think you will also need com.ibm.mq.jar and fmcojagt.jar
_________________
John McDonald
RETIRED
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
WSMQWorkflow
PostPosted: Wed Feb 25, 2004 4:16 pm    Post subject: Reply with quote

Novice

Joined: 25 Feb 2004
Posts: 12

The problem is solved. I am using WSAD 5.0. Adding j2ee.jar file solved the problem. I already had com.ibm.mq.jar and the rest of the jars except connector.jar and j2ee.jar. Adding them solved the problem. John thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Workflow Engines - IBM MQ Workflow & Business Process Choreographer » [solved]ResourceException
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.