3 Replies Latest reply on Jan 29, 2008 12:12 PM by kukeltje

    Exception the close jbpm context.

    danieltamiosso

      Hello guys,


      When I use only one signal, the process works normally. It has all the three nodes. If I use two signals followed the following error occurs:

      14:07:06,937 ERROR [JDBCTransaction] exception calling user Synchronization
      org.hibernate.QueryParameterException: could not locate named parameter [processInstance]
       at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:75)
       at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:81)
       at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:413)
       at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:383)
       at org.jbpm.db.JobSession$DeleteJobsSynchronization.beforeCompletion(JobSession.java:191)
       at org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion(JDBCTransaction.java:228)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:109)
       at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:256)
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:214)
       at org.jbpm.svc.Services.close(Services.java:225)
       at org.jbpm.JbpmContext.close(JbpmContext.java:139)
      


      The code:
      
      ...
      try{
      GraphSession graphSession = jbpmContext.getGraphSession();
       ProcessDefinition processDefinition = graphSession.findLatestProcessDefinition("analise-lancamentos-em-aberto");
      
       if (processDefinition == null) {
       processDefinition = ProcessDefinition.parseXmlResource("com/human/crm/jbpm/process/lancamento/processdefinition.xml");
       jbpmContext.deployProcessDefinition(processDefinition);
       }
      
      
       final List<Lancamento> lancamentosEmAberto = getLancamentoDAO().listLancamentosEmAberto();
       for (Lancamento lancamentoEmAberto : lancamentosEmAberto) {
       String key = String.valueOf(lancamentoEmAberto.getId());
       ProcessInstance processInstance = graphSession.getProcessInstance(processDefinition, key);
       if (processInstance == null) {
       processInstance = processDefinition.createProcessInstance();
       processInstance.setKey(key);
       }
      
       Token token = processInstance.getRootToken();
       token.signal();
       token.signal();
      
      jbpmContext.save(processInstance);
      
      
       }
      
       jbpmConfiguration.close();
      } catch (Exception ex) {
       log.error("", ex);
       } finally {
       jbpmContext.close();
       }