cancel
Showing results for 
Search instead for 
Did you mean: 

error in delegate java service task when using timer

idr_mdi
Champ in-the-making
Champ in-the-making
Hello,
i'm developing a java application, with spring and activiti intedgred in it.
the application is jpa and hibernate based for dataAccess.
here is my issue:
my activiti process is simple:
start event –> service task –> end event

when calling the dataAccessManager to insert feature in database during a service task java delegate i have no probleme. but when i change my process into this:

star event–> timer intermediate catch event –> service task –> end event
the timer just wait 10 second before calling de service taks, in this case i have this exception throwed:


ERROR: org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable - Job 97517 failed
org.springframework.aop.framework.adapter.UnknownAdviceTypeException: Advice object [null] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
   at org.springframework.aop.framework.adapter.DefaultAdvisorAdapterRegistry.getInterceptors(DefaultAdvisorAdapterRegistry.java:91)
   at org.springframework.aop.framework.DefaultAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(DefaultAdvisorChainFactory.java:65)
   at org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:489)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:193)
   at com.sun.proxy.$Proxy63.doIt(Unknown Source)
   at com.casaprestations.burs.acp.process.scripts.test.TEST.execute(TEST.java:19)
   at org.activiti.engine.impl.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:34)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:49)
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:40)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:143)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:60)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:96)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:633)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:628)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:96)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:633)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:628)
   at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:96)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:633)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:628)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:96)
   at org.activiti.engine.impl.jobexecutor.AsyncContinuationJobHandler.execute(AsyncContinuationJobHandler.java:35)
   at org.activiti.engine.impl.persistence.entity.JobEntity.execute(JobEntity.java:85)
   at org.activiti.engine.impl.persistence.entity.MessageEntity.execute(MessageEntity.java:34)
   at org.activiti.engine.impl.cmd.ExecuteAsyncJobCmd.execute(ExecuteAsyncJobCmd.java:52)
   at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:47)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:45)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
   at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
   at org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable.run(ExecuteAsyncRunnable.java:69)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)

the java delegate code : error is thrown in the save method


public class TEST implements JavaDelegate {
   
   @Override
   public void execute(DelegateExecution execution) throws Exception {
      // TODO Auto-generated method stub
            ITicketManager tm=(ITicketManager) execution.getVariable("ticketManager");
               Ticket ticket=new Ticket()
      tm.save(ticket);
   }
}


some infos:
i have tried to change the timer to async and various options of activating the jobExecutor and the syncExecutor, always the same issue.
the dataaccessmanager is @transactional annotated.
activiti version : 5.18.0
thanks guys for the help

3 REPLIES 3

vasile_dirla
Star Contributor
Star Contributor
"the dataaccessmanager is @transactional annotated."
that means you have @Transactional annotation in  ITicketManager? (if so, is it an interface, or a class?)
if you have @Transactional on the interface maybe is better to move it in the concrete class.

Would be nice if you could provide a unit test for it and then the community could investigate directly on your code (which is easier and productive than trying to reproduce it first)

idr_mdi
Champ in-the-making
Champ in-the-making
Hi vasile,

thanks for your reply.

ITicketManager is an interface, the implementation Class (TicketManager) is @Transactional annotated.
whene i execute the service java delegate as non asynchronous task , it executes. i can have the TicketManager instance from the line code
<code>
ITicketManager tm=(ITicketManager) execution.getVariable("ticketManager");
</code>

when i change the task to be asynchronous the same line code retrun a "com.sun.jdi.InvocationException occurred invoking method."

remark:
when calling other beans (not DataAccessBeans) , i have no problem the get the correct instance.

thanks

idr_mdi
Champ in-the-making
Champ in-the-making
Hey,

i found a solution for my problem.

i don't pass the TicketManager as a variable during the process start but  i inject it in the task via @Autowire (having the issue of null but solved it by setting  the java delegate tas as spring bean).

thanks.