04-09-2017 05:56 AM
i use activiti with jsf, when i start my process it's work but just for the first task so when i accomplishe my request and click button with this following code
<h:commandButton value="Submit" action="#{businessProcess.completeTask(true)}" /> i have this erreur
Avertissement: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
org.activiti.cdi.ActivitiCdiException: No task associated. Call businessProcess.startTask() first.
at org.activiti.cdi.BusinessProcess.assertTaskAssociated(BusinessProcess.java:540)
at org.activiti.cdi.BusinessProcess.completeTask(BusinessProcess.java:373)
at org.activiti.cdi.BusinessProcess.completeTask(BusinessProcess.java:385)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:779)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:528)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:257)
at com.sun.el.parser.AstValue.invoke(AstValue.java:248)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.primefaces.application.DialogActionListener.processAction(DialogActionListener.java:45)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:100)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:744)
04-10-2017 04:16 PM
It will be hard to offer any advice on this without a test case.
But, the message you are getting is typically thrown if you have not actually "started" the task.
A typical usage scenario might look like this:
1st unit of work ("process instantiation"):
conversation.begin();
...
businessProcess.setVariable("billingId", "1"); // setting variables before starting the process
businessProcess.startProcessByKey("billingProcess");
conversation.end();
2nd unit of work ("perform a user task"):
conversation.begin();
businessProcess.startTask(id); // now we have associated a task with the current conversation
... // this allows us to retrieve and change process variables
// and @BusinessProcessScoped beans
businessProcess.setVariable("billingDetails", "someValue"); // these changes are cached in the conversation
...
businessProcess.completeTask(); // now all changed process variables are flushed
conversation.end();
Notice, startTask() is called before completing the task.
Hope this helps,
Greg
bp3
04-11-2017 08:53 AM
hi and thanx,
problém not résolved
i start my process from my controller like this
ProcessInstance inst = runtimeService.startProcessInstanceByKey("myProcess");
my jsf page look like this
<f:view>
<f:metadata>
<f:viewParam name="taskId" />
<!-- start working on the usertask and starting a conversation -->
<f:event type="preRenderView" listener="#{businessProcess.startTask(taskId, true)}" />
</f:metadata>
<h1>#{task.name}</h1>
<p><em>#{task.description}hhhhhhhhhhh</em></p>
<p><em>#{taskId}</em></p>
<h:form>
<table>
<tr>
< td>client</td>
<td><h:inputText value="#{processVariables['client']}" disabled="true"/></td>
</tr>
<tr>
<td>date courante</td>
<td> <h:inputText value="#{processVariables['datecourante']}" disabled="true"/></td>
</tr>
<tr>
<td>login user</td>
<td> <h:inputText value="#{processVariables['login']}" disabled="true"/></td>
</tr>
<tr>
<td></td>
<td>
<h:commandButton value="Submit" action="#{businessProcess.completeTask(true)}" />
</td>
</tr>
</table>
</h:form>
</f:view>
06-01-2017 04:33 AM
the id of the current task is null
but on the Url http://localhost:8080/reservation-web/demande1.jsf?taskId=25013
when i complet the task the error apears
No task associated. Call businessProcess.startTask() first.
there is in the link the id of the task
help if yoiu can pleas