Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Process Manager (Stardust) » How can I suspend or abort process using "Spring Bean Applicationa"
How can I suspend or abort process using "Spring Bean Applicationa" [message #1219033] Fri, 29 November 2013 16:18 Go to next message
Marcin Brzeziński is currently offline Marcin Brzeziński
Messages: 2
Registered: November 2013
Junior Member
When I try to execute 'abortProcessInstance' method from org.eclipse.stardust.engine.api.spring.AdministrationServiceBean using Spring Bean Applicationa I get this error:

org.eclipse.stardust.common.error.PublicException: Rolling back activity thread.: BPMRT03903 - Illegal state change: Application --> Completed for Activity instance 'ApplicationActivity1', oid: 178 (process instance = 46) . Process instance state was Active. at org.eclipse.stardust.engine.core.runtime.beans.ActivityThread.run(ActivityThread.java:348) at org.eclipse.stardust.engine.core.runtime.beans.ActivityThread.schedule(ActivityThread.java:118) at org.eclipse.stardust.engine.core.runtime.audittrail.management.ActivityInstanceUtils.complete(ActivityInstanceUtils.java:363) at org.eclipse.stardust.engine.core.runtime.beans.WorkflowServiceImpl.complete(WorkflowServiceImpl.java:905) at org.eclipse.stardust.engine.core.runtime.beans.WorkflowServiceImpl.complete(WorkflowServiceImpl.java:790) at sun.reflect.GeneratedMethodAccessor1186.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.CallingInterceptor.invoke(CallingInterceptor.java:29) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.POJOExceptionHandler.invoke(POJOExceptionHandler.java:30) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.RuntimeExtensionsInterceptor.invoke(RuntimeExtensionsInterceptor.java:34) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.GuardingInterceptor.invoke(GuardingInterceptor.java:55) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.AbstractLoginInterceptor.performCall(AbstractLoginInterceptor.java:171) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.AbstractLoginInterceptor.invoke(AbstractLoginInterceptor.java:109) at org.eclipse.stardust.engine.api.spring.SpringBeanLoginInterceptor.invoke(SpringBeanLoginInterceptor.java:67) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.api.spring.SpringSessionInterceptor.doWithDataSource(SpringSessionInterceptor.java:143) at org.eclipse.stardust.engine.api.spring.SpringSessionInterceptor.access$000(SpringSessionInterceptor.java:48) at org.eclipse.stardust.engine.api.spring.SpringSessionInterceptor$1.doInConnection(SpringSessionInterceptor.java:87) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:341) at org.eclipse.stardust.engine.api.spring.SpringSessionInterceptor.invoke(SpringSessionInterceptor.java:81) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.api.spring.SpringConfigurationInterceptor.invoke(SpringConfigurationInterceptor.java:101) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.PropertyLayerProviderInterceptor.invoke(PropertyLayerProviderInterceptor.java:129) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.beans.interceptors.DebugInterceptor.invoke(DebugInterceptor.java:55) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.api.spring.SpringTxInterceptor$1.doInTransaction(SpringTxInterceptor.java:66) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.eclipse.stardust.engine.api.spring.SpringTxInterceptor.invoke(SpringTxInterceptor.java:51) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.proceed(MethodInvocationImpl.java:130) at org.eclipse.stardust.engine.core.runtime.interceptor.MethodInvocationImpl.execute(MethodInvocationImpl.java:68) at org.eclipse.stardust.engine.core.runtime.beans.InvocationManager.invoke(InvocationManager.java:53) at com.sun.proxy.$Proxy15.complete(Unknown Source) at org.eclipse.stardust.engine.api.spring.WorkflowServiceBean.complete(WorkflowServiceBean.java:68) at sun.reflect.GeneratedMethodAccessor1186.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.stardust.engine.api.spring.SpringServiceFactory$SpringServiceInvocationHandler.invoke(SpringServiceFactory.java:178) at com.sun.proxy.$Proxy15.complete(Unknown Source) at org.eclipse.stardust.ui.web.processportal.common.PPUtils.complete(PPUtils.java:438) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.completeCurrentActivityContinue(ActivityDetailsBean.java:1478) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.access$1000(ActivityDetailsBean.java:138) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean$7.handleEvent(ActivityDetailsBean.java:1455) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.retrieveOutDataMappingContinue(ActivityDetailsBean.java:1694) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.retrieveOutDataMapping(ActivityDetailsBean.java:1675) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.completeCurrentActivity(ActivityDetailsBean.java:1440) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.processActivityInstance(ActivityDetailsBean.java:1552) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.showMappedDocumentWarningAndProcessActivity(ActivityDetailsBean.java:1606) at org.eclipse.stardust.ui.web.processportal.view.ActivityDetailsBean.completeAction(ActivityDetailsBean.java:1424) at sun.reflect.GeneratedMethodAccessor1288.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.el.parser.AstValue.invoke(AstValue.java:130) at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274) at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69) at javax.faces.component.UICommand.broadcast(UICommand.java:89) at org.eclipse.stardust.ui.web.common.app.tags.TabScopedComponent.broadcast(TabScopedComponent.java:148) at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171) at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70) at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:50) at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:169) at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:110) at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:65) at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:51) at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:62) at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:55) at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:107) at com.icesoft.faces.webapp.http.servlet.BlockExpiredSessionRequests.service(BlockExpiredSessionRequests.java:53) at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:55) at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:204) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:71) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: org.eclipse.stardust.engine.api.runtime.IllegalStateChangeException: BPMRT03903 - Illegal state change: Application --> Completed for Activity instance 'ApplicationActivity1', oid: 178 (process instance = 46) . Process instance state was Active. at org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean.setState(ActivityInstanceBean.java:410) at org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean.doCompleteActivity(ActivityInstanceBean.java:1831) at org.eclipse.stardust.engine.core.runtime.beans.ActivityInstanceBean.complete(ActivityInstanceBean.java:1821) at org.eclipse.stardust.engine.core.runtime.beans.ActivityThread.runCurrentActivity(ActivityThread.java:847) at org.eclipse.stardust.engine.core.runtime.beans.ActivityThread.run(ActivityThread.java:330) ... 93 more 


Can I suspend or abort process, using process flow ?
Re: How can I suspend or abort process using "Spring Bean Applicationa" [message #1219115 is a reply to message #1219033] Mon, 02 December 2013 01:09 Go to previous messageGo to next message
Vikash Pandey is currently offline Vikash Pandey
Messages: 11
Registered: October 2011
Junior Member
is this the same activity which is invoking the spring bean and trying to abort the process instance that contains the very same application activity?

Please share the code that you are using to achieve this.

If you are trying to abort the same process instance that contains the activity, it can't be done, here is the reason:
12:05:09 INFO [090-exec-1] WorkflowServiceImpl - Aborting process instance Process instance = 75 (Process Definition: Process Definition 1) (model oid = 11, version = 1, revision = 1).
12:05:09 INFO [090-exec-1] ProcessInstanceBean - State change for Process instance = 75 (Process Definition: Process Definition 1) (model oid = 11, version = 1, revision = 1): Active-->Aborting.
12:05:09 ERROR [090-exec-1] ActivityInstanceBean - Invalid state change from Application to Completed because the process instance is in process of aborting.
12:05:09 WARN [090-exec-1] ApplicationException - Rolling back activity thread.
org.eclipse.stardust.engine.api.runtime.IllegalStateChangeException: BPMRT03903 - Illegal state change: Application --> Completed for Activity instance 'abortInstance', oid: 155 (process instance = 75) (model oid = 11, version = 1, revision = 1) . Process instance state was Active.


Proces Instance gets into aborting state and the activity is still in application and has to move to Completed.

About suspending a process - if the process instance has a manual activity and its in suspended state the process instance is in Active state. We can only suspend and save manual activities to either in users worklist or roles worklist.

This is how i would do it:
public class CleanWrongOrders {
	private static QueryService queryService;
	private static WorkflowService workflowService;
	private static UserService userService;
	private static AdministrationService adminService;
	private static DocumentManagementService documentService;
	public static QueryService getQueryService() {
		return queryService;
	}
	public static void setQueryService(QueryService queryService) {
		CleanWrongOrders.queryService = queryService;
	}
	public static WorkflowService getWorkflowService() {
		return workflowService;
	}
	public static void setWorkflowService(WorkflowService workflowService) {
		CleanWrongOrders.workflowService = workflowService;
	}
	public static UserService getUserService() {
		return userService;
	}
	public static void setUserService(UserService userService) {
		CleanWrongOrders.userService = userService;
	}
	public static AdministrationService getAdminService() {
		return adminService;
	}
	public static void setAdminService(AdministrationService adminService) {
		CleanWrongOrders.adminService = adminService;
	}
	public static DocumentManagementService getDocumentService() {
		return documentService;
	}
	public static void setDocumentService(DocumentManagementService documentService) {
		CleanWrongOrders.documentService = documentService;
	}
	
	@SuppressWarnings("deprecation")
	public static void cleanWrongOrders() {

		//This method will find out all the PIs that has value as Target Price is 0 or -ve
		//for a data name "WrongOrders" and abort those PIs.
		try {
			
			ActivityInstanceQuery query = ActivityInstanceQuery.findAlive("SecurityOrderProcess");
			
			FilterOrTerm itemFilter = query.getFilter().addOrTerm();
			itemFilter.or(DataFilter.isEqual("WrongOrders", "Target Price is 0 or -ve"));
			
			
			ActivityInstances activityInstances = queryService.getAllActivityInstances(query);
			System.out.println("Activity Instances: " + activityInstances);
			for (ActivityInstance activityInstance : activityInstances) {
				System.out.println("Process OID to abort: " + activityInstance.getProcessInstanceOID());
				workflowService.abortProcessInstance(activityInstance.getProcessInstanceOID(), AbortScope.RootHierarchy);
				
				
			}
			

		} catch (Exception e) {
			// Default thresholdMins to 10 minutes
			e.printStackTrace();
			
		} finally {
			
		}
	}
}



---------------
bean configuration:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
	<bean id="cleanWrongOrders" class="com.sungard.energy.enovos.ipp.training.CleanWrongOrders">
		<property name="userService" ref="carnotUserService" />
		<property name="queryService" ref="carnotQueryService" />
		<property name="adminService" ref="carnotAdministrationService" />
		<property name="workflowService" ref="carnotWorkflowService" />
		<property name="documentService" ref="carnotDocumentManagementService" />
		</bean>
		<bean id="enrichSecurity" class="com.sungard.energy.enovos.ipp.training.EnrichSecurity" />
</beans>

[Updated on: Mon, 02 December 2013 02:33]

Report message to a moderator

Re: How can I suspend or abort process using "Spring Bean Applicationa" [message #1219238 is a reply to message #1219115] Mon, 02 December 2013 15:22 Go to previous message
Marcin Brzeziński is currently offline Marcin Brzeziński
Messages: 2
Registered: November 2013
Junior Member
Hello,

thanks for Your replay. I was sure that it works a little differently.
Previous Topic:Unable to deploy stardust in Jboss 5.1
Next Topic:How to deploy stardust WAR to Tomcat
Goto Forum:
  


Current Time: Thu Jul 24 23:55:46 EDT 2014

Powered by FUDForum. Page generated in 0.01625 seconds