[JBoss jBPM] - Programmatically creating timer no longer works
by dleerob
Hi,
When using Jbpm 3.2.3, I created a timer programmatically, which has always been working. This is my code to create a timer on the fly:
public static void createTaskReminder(JbpmContext jbpmContext, TaskInstance taskInstance, Date dueDate, String repeat, String timerName) {
| try {
| // getting data from the context
| Token token = taskInstance.getToken();
|
| // creating the action
| Delegation timedDelegation = new Delegation("workflow.jbpm.TaskReminder");
| Action timedAction = new Action(timedDelegation);
|
| // creating the timer
| Timer timer = new Timer(token);
| timer.setName(timerName);
| timer.setAction(timedAction);
| timer.setRepeat(repeat);
| timer.setDueDate(dueDate);
| timer.setGraphElement(taskInstance.getTask().getTaskNode());
| timer.setTaskInstance(taskInstance);
|
| // scheduling the timer
| SchedulerService schedulerService = (SchedulerService) jbpmContext.getServices().getService(Services.SERVICENAME_SCHEDULER);
| schedulerService.createTimer(timer);
|
| }
| catch (Exception e) {
| e.printStackTrace();
| }
| }
I am now using the latest 3.2.6 SNAPSHOT, but when closing the jbpmContext, I get the following exception:
org.jbpm.persistence.JbpmPersistenceException: transaction commit failed
| at org.jbpm.persistence.db.DbPersistenceService.endTransaction(DbPersistenceService.java:136)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:197)
| at org.jbpm.svc.Services.close(Services.java:243)
| at org.jbpm.JbpmContext.close(JbpmContext.java:133)
| at za.co.itdynamics.workflow.webapp.action.BaseJbpmAction.execute(BaseJbpmAction.java:71)
| at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
| at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
| at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
| at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
| at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:375)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at za.co.itdynamics.workflow.webapp.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:42)
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at za.co.itdynamics.workflow.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter.java:55)
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
| at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
| at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:110)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:217)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:108)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:193)
| at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
| at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
| at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:78)
| at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
| at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
| at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
| at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
| at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
| at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
| at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
| at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
| at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
| at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
| at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
| at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
| at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
| at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.def.Action
| at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
| at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
| at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:242)
| at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:597)
| at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3123)
| at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:479)
| at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:204)
| at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:127)
| at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
| at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:226)
| at org.jbpm.persistence.db.DbPersistenceService.endTransaction(DbPersistenceService.java:131)
| ... 85 more
|
Any ideas what has changed, or what I am doing wrong?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211821#4211821
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211821
15 years, 8 months