Author |
Message
|
Nisa |
Posted: Thu Dec 12, 2002 2:01 pm Post subject: [Solved]FMC00126E Program Execution Agent not running |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
I am using Workflow Java API to login to the Workflow and trying to access the OutContainer data of the WorkItem.
I could able to Login successfully and query the WorkItems perfectly.
but to modify the OutContainer data, I am trying to get the outContainer
Here is how I am logging in:
agent = new Agent();
agent.setLocator(Agent.LOC_LOCATOR);
agent.setName("LOC");
service = agent.locate("DEVGRP"),"DEVSYS"));
and using : agent.getExecutionAgent().outContainer(); to access the outContainer.
this throws and Exception :
FMC38009E MQSeries Workflow API Error :
API Return Code : 126
Error Origin : /projects/fmc/drvp/lbld/v332/src/fmcjccon.cxx, line 1424
Error Message : FMC00126E Program Execution Agent not running
Nested Exception : None
if I try to start PEA, it get the Message that its already started..
please throw your ideas, how I should handle this..
Thank you,
Vani. |
|
Back to top |
|
 |
Ratan |
Posted: Thu Dec 12, 2002 2:31 pm Post subject: |
|
|
 Grand Master
Joined: 18 Jul 2002 Posts: 1245
|
how are you running your application. It should run from within the PEA.
Let us know how you are starting the workitem and if the program you are trying to run is the associated program for the workitem.
-Laze. |
|
Back to top |
|
 |
vennela |
Posted: Thu Dec 12, 2002 2:32 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Vani/Nisa
you are mixing two things here
1. It's partly a client application
2. It's partly an activity implementation
If it's an activity implementation you don't have to logon. And the PEA will invoke this program... if you invoke the program from the command line you would get this error.
If it's a client type application your loggin on part is ok
What you have to do after that is
use queryWorkItems() method of ExecutionService class and then from the workItems get the input/output containers.
---
Venny |
|
Back to top |
|
 |
jmac |
Posted: Thu Dec 12, 2002 3:32 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Nisa:
The bottom line is:
If you have an activityImplementation then you want code like this:
Code: |
Agent myAgent = new Agent(); // create the agent
myAgent.setLocator(Agent.LOC_LOCATOR); // indicate local to MQWF
myAgent.setName("AGENT"); // specify bogus agent name
// Get the execution agent
ExecutionAgent myExecAgent = myAgent.getExecutionAgent();
System.out.println("MQWorkflow JAVA environment established" );
// Access the Input and Output containers for the activity
ReadOnlyContainer inputContainer = myExecAgent.inContainer();
System.out.println("The input container uses structure " +
inputContainer.type() );
ReadWriteContainer outputContainer = myExecAgent.outContainer();
System.out.println("The output container uses structure " +
outputContainer.type() ); |
If you want a Client Application you want code like this:
Code: |
Agent myAgent = new Agent(); // create the agent
myAgent.setLocator(Agent.LOC_LOCATOR); // indicate local to MQWF
myAgent.setName("AGENT"); // specify bogus agent name
service = myAgent.locate("",""); // create execution service agent for
// default systemgroup and system
service.logon2("ADMIN", // userid
"password", // password
SessionMode.PRESENT_HERE, // FORCE LOGON
AbsenceIndicator.LEAVE ); // Leave Absence indicator "as is"
System.out.println("Logon for user " + service.userID()
+ " successful" );
// Access the proper activity using a filter
// This example shows an activity name of Open Acct
StringBuffer filter = new StringBuffer(
"NAME = 'Open Acct' AND OWNER = CURRENT_USER" );
WorkItem[] wi = service.queryWorkItems(filter.toString(), // filter
null, // NO Sort Criteria
null); // NO Threshhold
if (wi.length == 0) // if no workitem just end
System.out.println("Could not find the workitem");
else
{
// Access the Input and Output containers for the activity
ReadOnlyContainer inputContainer = wi[0].checkOut(); // do a Checkout
System.out.println("Workitem " + wi[0].name()
+ " CheckedOut successfully" );
System.out.println("The input container uses data structure "
+ inputContainer.type() );
ReadWriteContainer outputContainer = wi[0].outContainer();
System.out.println("The output container uses structure " +
outputContainer.type() ); |
An ActivityImplementation uses an ExecutionAgent, and NEVER logs in. If it needs to do any "Process Control" apis (basically anything other than Container Access) it must initialize an execution service using the passthrough method like this:
Code: |
ExecutionService svc = svc.passthrough(); |
A client uses an ExecutionService and ALWAYS logs in.
Good Luck _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
Nisa |
Posted: Fri Dec 13, 2002 5:21 am Post subject: |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
Thanks for your reply..but it did not solve my problem..
I am using the Client Application, and by using just this call,
wi[0].outContainer.setString("name","value");
the outputContainer is not updated.
I guess I should send the outputcontainer to the Workflow again as:
agent.getExecutionAgent().setOutContainer(wi[0].outContainer);
This results in the same exception. again.. |
|
Back to top |
|
 |
vennela |
Posted: Fri Dec 13, 2002 5:46 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
You CANNOT use the getExecutionAgent in a client type application.
It's only useful if the program is invoked by Workflow.
If you want to set the container values you have to checkout the workitem and checkin with the OutContainer data. Take a look at the WorkItem api in the java documentation.
---
Venny |
|
Back to top |
|
 |
Nisa |
Posted: Fri Dec 13, 2002 6:04 am Post subject: |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
yes u r right,
the other way, I tried is...
wiArr[0].outContainer().setString("Documents.DeleteDoc","VTest");
wiArr[0].checkIn(wiArr[0].outContainer(), 0);
I get FMC38009E MQSeries Workflow API Error :
API Return Code : 120
Error Origin : /projects/fmc/drvp/lbld/v332/src/fmcjcitm.cxx, line 3831
Error Message : FMC00120E State does not allow this action
Nested Exception : None |
|
Back to top |
|
 |
Nisa |
Posted: Fri Dec 13, 2002 7:35 am Post subject: |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
How about this ?
com.ibm.workflow.api.ProgramData prgData =
wiArr[0].checkOut2(com.ibm.workflow.api.WorkItemPackage.ProgramRetrieval.ALL_DEFINITIONS,
com.ibm.workflow.api.ProgramTemplatePackage.Basis.AIX);
ReadWriteContainer rwCntr = prgData.outContainer();
rwCntr.setString("Documents.DeleteDoc","VTest");
wiArr[0].checkIn(rwCntr,0);
with this I don't get any exceptions, but the Container is not updated. I don't see any data in the OutContainer after this.. |
|
Back to top |
|
 |
vennela |
Posted: Fri Dec 13, 2002 7:53 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Nisa:
I am not sure what you are trying to do.
If it's a client type application you CANNOT set the container data. You can set it only in an activity implementation program.
---
Venny |
|
Back to top |
|
 |
jmac |
Posted: Fri Dec 13, 2002 8:19 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Venny/Nisa:
You can set output container AS LONG AS you have done a checkout. In the code Nisa is posting I only see a checkout in the the last post, it is a checkout2 which is fine.
Now when you use checkout2 you would need to use wi.inContainer() to access the input container, but it appears that Nisa does not care about the input container. You should use wi.outContainer to access the output container. Nisa is using the output container from the ProgramData, this is definitely a problem. Change this to
Code: |
ReadWriteContainer rwCntr = wiArr[0].outContainer(); |
And I think it will work.
The reason the earlier code was failing with "Wrong State" was there was NO checkout and you can only issue checkin if item is in Checkedout state. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
Nisa |
Posted: Fri Dec 13, 2002 9:22 am Post subject: |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
I tried both the ways of checkIn..Container Member is not set.
ReadWriteContainer rwCntr = wiArr[0].outContainer();
rwCntr.setString("Documents.DeleteDoc","VTest");
wiArr[0].checkIn(rwCntr,0);
as well as
wiArr[0].checkIn(wiArr[0].outContainer(), 0); |
|
Back to top |
|
 |
jmac |
Posted: Fri Dec 13, 2002 9:25 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
How are you determining that the Output container is not set?
Because If you did what you just said it should be set. Unless of course you are just eating FmcExceptions. Hopefully you dont have a catch block that looks like this
Code: |
catch(FmcException f) {} |
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
Nisa |
Posted: Fri Dec 13, 2002 9:39 am Post subject: |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
well, I do get the Exception, If I try to get the data :
System.out.println("ouput = "+wiArr[0].outContainer().getString("Documents.DeleteDoc"));
com.ibm.workflow.api.FmcException:
FMC38009E MQSeries Workflow API Error :
API Return Code : 113
Error Origin : /projects/fmc/drvp/lbld/v332/src/fmcjccon.cxx, line 692
Error Message : FMC00113E Container member not set
Nested Exception : None |
|
Back to top |
|
 |
Nisa |
Posted: Fri Dec 13, 2002 11:04 am Post subject: |
|
|
Novice
Joined: 11 Apr 2002 Posts: 19
|
GREAT !!
Thanks for all your Help!!
finally It did Work with the previous code itself:
but had to tweak little bit with the Data Mapping in the BuildTime to get displayed in the WebClient. I am unable to print becoz, it moves to next activity.. thatz fine... I am happy...
com.ibm.workflow.api.ProgramData prgData =
wiArr[0].checkOut2(com.ibm.workflow.api.WorkItemPackage.ProgramRetrieval.ALL_DEFINITIONS,
com.ibm.workflow.api.ProgramTemplatePackage.Basis.AIX);
ReadWriteContainer rwCntr = wiArr[0].outContainer();
rwCntr.setString("Documents.DeleteDoc","VTest");
rwCntr.setString("Documents.Awakened","Y");
wiArr[0].checkIn(rwCntr,0); |
|
Back to top |
|
 |
jmac |
Posted: Sat Dec 14, 2002 10:20 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Nisa:
I'm glad you got this working, but I would consider using checkout instead of checkout2... UNLESS you really need the ProgramData object, which based on the snips of code you posted, I dont think is true.
My gut tells me that checkout is probably a "cheaper" API call than checkout2. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
|