How can I forward catched exception?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2011 08:46 AM
Hallo all,
this is my process definition:
the diagramm:
[attachment=0]archive_document_v2.png[/attachment].
I want to catch all exceptions that can be throwen during SibelTask and write the stack trace into the file.
Is it possible with boundary error event?
If yes, how can I forward with boundary error event catched error or exception to the next Java Service task?
Thanks
Alexej
this is my process definition:
<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"> <process id="siebel" name="siebel"> <startEvent id="startevent3" name="Start"></startEvent> <serviceTask id="servicetask1" name="SiebelTask" activiti:class="de.ec4u.c4.workflowserver.servicetasks.SiebelTask"></serviceTask> <endEvent id="endevent3" name="End"></endEvent> <sequenceFlow id="flow2" name="" sourceRef="startevent3" targetRef="servicetask1"></sequenceFlow> <sequenceFlow id="flow3" name="" sourceRef="servicetask1" targetRef="endevent3"></sequenceFlow> <boundaryEvent attachedToRef="servicetask1" cancelActivity="true" id="boundaryerror1" name="" parallelMultiple="false"> <errorEventDefinition/> </boundaryEvent> <sequenceFlow id="flow4" name="to Service Task" sourceRef="boundaryerror1" targetRef="servicetask2"></sequenceFlow> <serviceTask id="servicetask2" name="WriteToFile" activiti:class="de.ec4u.c4.workflowserver.servicetasks.WriteToFile"></serviceTask> <endEvent id="endevent4" name="End"></endEvent> <sequenceFlow id="flow5" name="" sourceRef="servicetask2" targetRef="endevent4"></sequenceFlow> </process></definitions>
the diagramm:
[attachment=0]archive_document_v2.png[/attachment].
I want to catch all exceptions that can be throwen during SibelTask and write the stack trace into the file.
Is it possible with boundary error event?
If yes, how can I forward with boundary error event catched error or exception to the next Java Service task?
Thanks
Alexej
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2011 06:53 AM
I think I found what I need:
transition = execution.getActivity().findOutgoingTransition("no-exception");
It isn't perfect, but at least I am able ty change a path if exception was thrown.
The problem is: I can't call getActivity() on DelegateExecution obejct.
Why it isn't available any more? How can I handle exceptions with Activity v5.3?
Thanks
Alexej
transition = execution.getActivity().findOutgoingTransition("no-exception");
It isn't perfect, but at least I am able ty change a path if exception was thrown.
The problem is: I can't call getActivity() on DelegateExecution obejct.
Why it isn't available any more? How can I handle exceptions with Activity v5.3?
Thanks
Alexej

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2011 07:39 AM
Sorry for my inattention,
I found the error.
The Service Task should implemet ActivityBehavior instead of JavaDelegation
and execute(XX) with ActivityExecution instead of DeleagteExecution
The problem ist solved.
I found the error.
The Service Task should implemet ActivityBehavior instead of JavaDelegation
public class SiebelTask implements ActivityBehavior{
…
}
and execute(XX) with ActivityExecution instead of DeleagteExecution
public void execute(ActivityExecution execution) throws Exception {
…
}
The problem ist solved.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2011 05:32 AM
Thanks for posting your solution! Your analysis is indeed correct.
