2 Replies Latest reply on Oct 7, 2010 9:00 AM by uesker

    JBPM: task process id may not be null

    uesker

      Hi!


      I resolved to strart a new thread because the previous was too confuse.


      I´m working with JBPM and when I access a specific page I have to do litle system processing with values comes from a form. So I´m trying to do that with ajax request.


      Here is a one case that exemplifies the problem.


      the page.xml



      <end-conversation/>
       <param name="taskId"/>
       <action execute="#{secondaryQuestionAction.startFillSecondaryQuestion}"/>



      the specific page, that contains a button that get the value from text area and add it in a data table



              <rich:panel>
                  <f:facet name="header">#{messages['srprocess.fillsecondaryquestion.page.title']}</f:facet>
                              <h:outputText value="#{messages['srprocess.fillsecondaryquestion.page.description']}"/><br/>
                              <rich:spacer height="20px"/>
                              
                              <s:decorate id="questaoSecundaria" template="/layout/edit.xhtml">
                                      <ui:define name="label">#{messages['srprocess.fillsecondaryquestion.page.question']}</ui:define>
                                      <h:inputTextarea cols="100" rows="5" value="#{secondaryQuestion.question}"/>
                              </s:decorate>
                  
                  <a4j:commandButton value="#{messages['command.add']}" 
                      actionListener="#{secondaryQuestionAction.addSecondaryQuestion}" reRender="tabelaQuestoes">
                  </a4j:commandButton>
      
                  <a4j:outputPanel id="tabelaQuestoes" rendered="#{secondaryQuestionAction.exibeTabelaQuestoes}">
                          <h:outputText value="#{messages['srprocess.fillsecondaryquestion.questionstable.description']}"/>
                          <rich:dataTable id="tableSecondaryQuestion" value="#{secondaryQuestionAction.secondaryQuestionList}" var="q">
                              <rich:column>
                                      #{q.question}
                              </rich:column>
                          </rich:dataTable>
                  </a4j:outputPanel>
                  
                  <div style="clear: both" />
              </rich:panel>



      And finnaly, the bean



      @Name("secondaryQuestionAction")
      @Scope(ScopeType.PAGE)
      public class SecondaryQuestionAction implements Serializable {
      
              
              private static final long serialVersionUID = 8394705048656015853L;
              
              @In
              private StatusMessages statusMessages;
              
              @In(required=false)
              @Out(scope=ScopeType.BUSINESS_PROCESS, required=false)
              protected SRProtocol srProtocol;
              
              @In
              private SecondaryQuestion secondaryQuestion;
              
              private List<SecondaryQuestion> secondaryQuestionList;
              
              private boolean exibeTabelaQuestoes;
              
              public boolean isExibeTabelaQuestoes() {
                      return exibeTabelaQuestoes;
              }
      
              public void setExibeTabelaQuestoes(boolean exibeTabelaQuestoes) {
                      this.exibeTabelaQuestoes = exibeTabelaQuestoes;
              }
      
              public List<SecondaryQuestion> getSecondaryQuestionList() {
                      return secondaryQuestionList;
              }
      
              public void setSecondaryQuestionList(
                              List<SecondaryQuestion> secondaryQuestionList) {
                      this.secondaryQuestionList = secondaryQuestionList;
              }
      
              @BeginTask
              public void startFillSecondaryQuestion() {
                      if (secondaryQuestionList == null) {
                              secondaryQuestionList = new ArrayList<SecondaryQuestion>();
                      }
                      statusMessages.addFromResourceBundle("task.initiated.message");
              }
              
              @EndTask
              public String endFillSecondaryQuestion() {
                      if (srProtocol != null) {
                              srProtocol.setSecundaryQuestionList(secondaryQuestionList);
                      }
                      statusMessages.addFromResourceBundle("srprocess.fillsecondaryquestion.page.success");
                      return "/listarTarefas.xhtml";
              }
              
              public void addSecondaryQuestion(ActionEvent event) {
                      if (secondaryQuestion != null) {
                              secondaryQuestionList.add(secondaryQuestion);
                              secondaryQuestion = null;
                      }
              }
      }
      



      When I press the button that call addSecondaryQuestion method, an exception is thrown with message



      Caused by java.lang.IllegalStateException with message: "task/process id may not be null"
      
      org.jboss.seam.bpm.BusinessProcessInterceptor.getProcessOrTaskId(BusinessProcessInterceptor.java:161)
      org.jboss.seam.bpm.BusinessProcessInterceptor.beforeInvocation(BusinessProcessInterceptor.java:69)
      org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:45)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
      org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
      org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
      br.ufrj.cos.ese.configuradorrs.session.researchQuestion.SecondaryQuestionAction_$$_javassist_seam_14.startFillSecondaryQuestion(SecondaryQuestionAction_$$_javassist_seam_14.java)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      



      I´m was wondering why the task Id was lost, even with PAGE scope. So, how can I solve this?



      Thanks!





        • 1. Re: JBPM: task process id may not be null
          lvdberg

          Hi,


          me again. Seam must inject the TaskId somewhere, so you should have a list of task from which you initiated this specific task. If this is true, the page action should provide such a task id in the request. So when you perform the action it must have an action parameter included. Look at the specfic seam jsf elements. There is one to include the task. The s:button can do the same, but you need the ajax handling, so you must provide the parameter in the call.


          Leo

          • 2. Re: JBPM: task process id may not be null
            uesker

            Hi Leo!
            It works! I have another  doubt on this page but it´s not relationed with JBPM, so I´ll start a new thread.


            Thanks for the help