on ‎2011 Sep 29 5:17 PM
Dear experts,
Can someone please help?
Based on guidance in this forum, I created a test workflow which has 3 activities and one final block activity. The 3 activities have prescript like this
GroupIBeanHomeIfc home = (GroupIBeanHomeIfc) IBeanHomeLocator.lookup(session, GroupIBeanHomeIfc.sHOME_NAME);
sam_grp= home.findGroup("Approvers");
addApprover(sam_grp.getObjectReference(), new CollaboratorApprovalRuleType(0));
found = true;
if(!found) {
+ cancelProcess("No routing data found");+
}
The block activity has the following in the prescript
home = IBeanHomeLocator.lookup(session, UserDefinedBizDoc1IBeanHomeIfc.sHOME_NAME);
home.upgradeToEdit(doc);
if(getApprovalStatus() != DENIED) {
home.changePhase(doc, "Approved");
}
else {
home.changePhase(doc,"Created");
}
I am able to approve and the activities proceed. After the final approval, the phase does change to "Approved", but the system lock does not get release. At every step there is a null point error in Background Task Status
Log Level:Error
Session ID:odp_event_workflow_engine
Event Type:ODP_EVENT_WORKFLOW_ENGINEEvent SubType:1Event Source:test wf 13Event Target:
User:daemon
Description:Workflow Engine
Message:Unexpected error handling event
Description of documentException:java.lang.NullPointerException
Stack Trace:java.lang.NullPointerException
at com.sap.odp.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processActivity(PhaseChangeInstantiationRequestHandler.java:351)
at com.sap.odp.workflow.engine.handlers.PhaseChangeInstantiationRequestHandler.processHook(PhaseChangeInstantiationRequestHandler.java:249)
at com.sap.odp.workflow.engine.handlers.WorkflowEngineRequestHandler.process(WorkflowEngineRequestHandler.java:197)
at com.sap.odp.workflow.engine.WorkflowEngine.process(WorkflowEngine.java:412)
at com.sap.odp.workflow.engine.WorkflowEngine.processPhaseChangeInstantiationRequest(WorkflowEngine.java:134)
at com.sap.odp.workflow.engine.WorkflowEngineDaemon.processPhaseChangeInstantiationRequest(WorkflowEngineDaemon.java:328)
at com.sap.odp.workflow.engine.WorkflowEngineDaemon.processHook(WorkflowEngineDaemon.java:148)
at com.sap.odp.comp.daemon.AbsEventDaemon.process(AbsEventDaemon.java:160)
at com.sap.odp.comp.daemon.ResponsibleEventDaemon.runHook(ResponsibleEventDa...
Event Type:ODP_EVENT_WORKFLOW_ENGINE
Event SubType:1
Event Source:test wf 13
Can anyone please help,
Thanks, MP
Request clarification before answering.
In addition, every 30 mins, the system sends emails to all approvers for all 3 activities of the XPDL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I redesigned my XPDL to add an ending block activity and now I get the same NullPointer error only at the last step where I am advancing the phase of the document. I saw a message in the logs.
2011-10-03 10:54:16.05 INFO local4 Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon ***** Workflow MP end edit mode
2011-10-03 10:54:16.126 DEBUG local4 SystemEventComponent post() Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon The IAPI Event was discarded because there are currently no registered handlers. (ClassId=9999101, Type=ODP_DOC_DOCUMENT_SAVED)2011-10-03 10:54:16.126 INFO local4 Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon ***** Workflow MP end set to approved
Does anyone know what this means, "The IAPI Event was discarded because there are currently no registered handlers."
Thanks MP.
Hi MP,
From the earlier exceptions it looks like one of the activity step misses a <FinishMode> element. This could be due to the version of xpdl editor that is used to create this file or the file corrupt. Please check. Open the xpdl file in text editor and search for "FinishMode" and see if you see any discrepancies between activities...
The last warning message is just a red herring & this warning message in the log is normal. This message is because in DEBUG mode the system checks if there are any integration classes associated with your Userdefined BIzdoc.
Thanks,Baski
Hi Baski,
Thank you for responding, really appreciate it. I checked. my XPDL was missing the FinishMode for the final block activity. I added it manually since I could not set it through the editor. After this I now get the following error.
+Sourced file: inline evaluation of: ``import com.sap.odp.api.common.; import com.sap.odp.api.doccommon.userdefined.; . . . '' : TargetError : at Line: 32 : in file: inline evaluation of: ``import com.sap.odp.api.common.; import com.sap.odp.api.doccommon.userdefined.; . . . '' : throw doc .createApplicationException ( null , e .getAssociatedAttribute ( ) + "-" + e .getMessage ( ) + ";;;;;;;;" + doc .getCurrentPhase ( ) .getDisplayName ( ) ) ;+
+Target exception: com.sap.odp.api.common.exception.ApplicationException: ID: PHASE_ERROR-You may not transition to the target phase Approved. It is neither a valid next nor previous phase.;;;;;;;;Approve
d+
From the logs it looks like the script is getting executed twice. I have added the final script to the Postscript extended attribute of the final block activity. Is this correct?
Here is the pertinent section of the log.
2011-10-04 11:06:52.651 DEBUG local4 ScriptEnvironment execute Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon executing script: import com.sap.odp.api.common.;|import com.sap.odp.api.doccommon.userdefined.;|try{|logMsg = Logger.createLogMessage(session);|counter=1;|home = IBeanHomeLocator.lookup(session, UserDefinedBizDoc1IBeanHomeIfc.sHOME_NAME);|counter=counter1;|home.upgradeToEdit(doc);|logMsg.setLogMessage("***** Workflow MP end edit mode"";;;;;"doc.getCurrentPhase().getDisplayName());|counter=counter1;|Logger.info(logMsg);|counter=counter1;|if(getApprovalStatus() != DENIED) {|counter=counter1;|home.changePhase(doc, "Approved");|counter=counter1;|logMsg.setLogMessage("***** Workflow MP end set to approved"";;;;;"doc.getCurrentPhase().getDisplayName());|counter=counter1;|Logger.info(logMsg);|counter=counter1;|}|else {|home.changePhase(doc,"Created");|logMsg.setLogMessage("***** Workflow MP end set to Created"";;;;;"doc.getCurrentPhase().getDisplayName());|Logger.info(logMsg);|}|}|catch(e){|throw doc.createApplicationException(null,e.getAssociatedAttribute()"-"e.getMessage()";;;;;;;;"doc.getCurrentPhase().getDisplayName());}+
2011-10-04 11:06:52.657 INFO local4 Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon ***** Workflow MP end edit mode;;;;;null
2011-10-04 11:06:52.766 DEBUG local4 SystemEventComponent post() Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon The IAPI Event was discarded because there are currently no registered handlers. (ClassId=9999101, Type=ODP_DOC_DOCUMENT_SAVED)
2011-10-04 11:06:52.767 INFO local4 Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon ***** Workflow MP end set to approved;;;;;Approved
2011-10-04 11:06:52.82 DEBUG local4 ScriptEnvironment execute Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon executing script: import com.sap.odp.api.common.;|import com.sap.odp.api.doccommon.userdefined.;|try{|logMsg = Logger.createLogMessage(session);|counter=1;|home = IBeanHomeLocator.lookup(session, UserDefinedBizDoc1IBeanHomeIfc.sHOME_NAME);|counter=counter1;|home.upgradeToEdit(doc);|logMsg.setLogMessage("***** Workflow MP end edit mode"";;;;;"doc.getCurrentPhase().getDisplayName());|counter=counter1;|Logger.info(logMsg);|counter=counter1;|if(getApprovalStatus() != DENIED) {|counter=counter1;|home.changePhase(doc, "Approved");|counter=counter1;|logMsg.setLogMessage("***** Workflow MP end set to approved"";;;;;"doc.getCurrentPhase().getDisplayName());|counter=counter1;|Logger.info(logMsg);|counter=counter1;|}|else {|home.changePhase(doc,"Created");|logMsg.setLogMessage("***** Workflow MP end set to Created"";;;;;"doc.getCurrentPhase().getDisplayName());|Logger.info(logMsg);|}|}|catch(e){|throw doc.createApplicationException(null,e.getAssociatedAttribute()"-"e.getMessage()";;;;;;;;"doc.getCurrentPhase().getDisplayName());}+
2011-10-04 11:06:52.825 INFO local4 Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon ***** Workflow MP end edit mode;;;;;Approved
+2011-10-04 11:06:52.846 ERROR local4 ScriptEnvironment execute Daemon-0108: ODP_EVENT_WORKFLOW_ENGINE (-2147483548) odp_event_workflow_engine #jci.context.id# daemon Sourced file: inline evaluation of: ``import com.sap.odp.api.common.; import com.sap.odp.api.doccommon.userdefined.; . . . '' : TargetError : at Line: 32 : in file: inline evaluation of: ``import com.sap.odp.api.common.; import com.sap.odp.api.doccommon.userdefined.; . . . '' : throw doc .createApplicationException ( null , e .getAssociatedAttribute ( ) + "-" + e .getMessage ( ) + ";;;;;;;;" + doc .getCurrentPhase ( ) .getDisplayName ( ) ) ;+
And here is the Postscript code of my final block activity.
import com.sap.odp.api.common.*;
import com.sap.odp.api.doccommon.userdefined.*;
try{
logMsg = Logger.createLogMessage(session);
home = IBeanHomeLocator.lookup(session, UserDefinedBizDoc1IBeanHomeIfc.sHOME_NAME);
home.upgradeToEdit(doc);
logMsg.setLogMessage("***** Workflow MP end edit mode"+";;;;;"+doc.getCurrentPhase().getDisplayName());
Logger.info(logMsg);
if(getApprovalStatus() != DENIED) {
home.changePhase(doc, "Approved");
logMsg.setLogMessage("***** Workflow MP end set to approved"+";;;;;"+doc.getCurrentPhase().getDisplayName());
Logger.info(logMsg);
}
else {
home.changePhase(doc,"Created");
logMsg.setLogMessage("***** Workflow MP end set to Created"+";;;;;"+doc.getCurrentPhase().getDisplayName());
Logger.info(logMsg);
}
}
catch(e){
throw doc.createApplicationException(null,e.getAssociatedAttribute()+"-"+e.getMessage()+";;;;;;;;"+doc.getCurrentPhase().getDisplayName());
}
Hi,
In the postScript. attempting the phase change to "Approved" phase is done and this is done by the workflow engine as welll at the end. this could be the cause of hte issue..
comment the floowing lines & check
if(getApprovalStatus() != DENIED) {
home.changePhase(doc, "Approved");
logMsg.setLogMessage("***** Workflow MP end set to approved"";;;;;"doc.getCurrentPhase().getDisplayName());
Logger.info(logMsg);
}
Hi Baski,
Thank you so much for your continued help.
I no longer get the error after commenting the code. Could you provide me an overview of how I should structure my phases? I had created the following phases
Created
Review & Approval (this phase has thr XPDL associated)
Approved
During the workflow, the 2nd phase is shown as "Review & Approval (Approval Phase)". If the item is approved, I was trying to advance to the next phase called "Approved". After your post, I removed the last phase and now after the approvals are completed, the phase is shown as "Review & Approval (Approved)". So sounds like I dont need the 3rd phase, is that correct?
What about on rejection? Do I need to set the phase back to Created or will the workflow do that. I had the same error, stating "You may not transition to the target phase Draft phase. It is neither a valid next nor previous phase.;;;;;;;;Created". It shows that the current phase is already Created. I tried by removing the postscript of my last block activity, and if I reject, the phase shows up as Review & Approval (Rejected)", but the phase did not move back to Created. What should I do here?
I am struggling to understand if we need any code at all in the postscript of the last block activity.
Thanks,
MP
Hi,
If you need to advance to another phase(like approved) from the post script you can do that keeping your current phase list. You should make sure you are not attempting to move twice to same phase again. Do a check in your script about the current phase before attempting to do a move.
For the other issue, navigate to phase definition and mark "Created" as valid phase for "Review & Approval". This should take care of the rejection scenario
Thanks,
Baski
Thanks Bhaski,
I put a check in to not move back to Created if it was already in Created. I am curious to understand though why my postscript is getting executed twice. I can see my logging messages also twice, so it is definitely getting executed twice. It is relatively simple XPDL, 3 steps, one final block. The second is conditional, so the transition condition for that to the 3rd activity is getApprovalStatus() != PENDING and from the 2nd to the final block is getApprovalStatus() == DENIED.
Any suggestions?
Thanks,
MP
I know this question is answered, but I wanted to offer some specific information.
- JaWE 3.2.2 and earlier is XPDL 1.0 compliant
- JaWE 4.1.1 and later is XPDL 2.0 compliant
- JaWE 4.1.1 automatically converts loaded files to XPDL 2.0. From what I can see, this behavior can't be altered.
- In XPDL 2.0 the FinishMode and StartMode are attributes of the Actvitiy Element
<xpdl:Activity FinishMode="Automatic" Id="Level1" Name="Add Approvers" StartMode="Automatic">- In XPDL 1.0 these attributes are Elements
<Activity Id="Level1" Name="Add Approvers">
<Implementation>
<No/>
</Implementation>
<Performer>PAR02</Performer>
<StartMode>
<Automatic/>
</StartMode>
<FinishMode>
<Automatic/>
</FinishMode>
- eSourcing's Workflow Engine is only 1.0 compliant, and is looking for Elements. If it doesn't find them, the NPE is thrown.
Bottom line: use 3.2.2 or earlier for editing your worfklows.
Regarding the post script being executed twice. This is a known bug that's been around for some time.
One thing you can do is to surround your phase changes in a try ... catch e.g.:
try {
doc.getIBeanHomeIfc().changePhase(doc, "Draft");
} catch(e) {
Logger.warning(Logger.createLogMessage(session).
setLogMessage("Workflow Phase change error. Note that this could be a known bug").setException(e));
}
This way the code will still work cleanly when the bug gets fixed.
Thank you for the response. It really helped clear things up.
For the phase transition, I finally checked to see if the phase is not already Draft, then set to Draft.
For the XPDL, I am using TWE version 2.1-1, however it did not let me set a FinishMode for the block activity without first setting a block id, error "Block Id: The value must be defined!". I could not find a way to set the block ID without creating sub-activities, which did not make sense to me. So I just implemented Baski's suggestion and edited the XPDL manually to set Finish Mode "Automatic" for my block activity.
Thanks,
MP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.