4 Replies Latest reply on Sep 21, 2012 2:37 AM by Avneesh Sisodia

    JBPM(Human Task)+Spring+Hibernate on JBoss AS 7

    Avneesh Sisodia Newbie

      Hi All,

      I need a running project of jbpm human task with spring.

      I have a project which I got from https://github.com/Nijhazer/jbpm-spring-quickstart .I am able to configure it with JBoss AS 7 and deploy it. After deploying it I saw that in this project jbpm human task is not used.

      Guys I need a projectwhich uses human task (jbpm5) with spring runnig on JBoss .

      If any one know link of example or any complete tutorial please share here.

      Thanks.

        • 2. Re: JBPM(Human Task)+Spring+Hibernate on JBoss AS 7
          Avneesh Sisodia Newbie

          Thanks for the link wqe . I read it and do all things explained there . But I have not idea how to use to read process file.

           

          I used this to read process file

           

           

          KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
                  kbuilder.add( ResourceFactory.newClassPathResource("SampleHumanTaskProcess.bpmn"), ResourceType.BPMN2 );
                  ksession.startProcess("com.sample.bpmn");
          

          But not able to read process.

          • 3. Re: JBPM(Human Task)+Spring+Hibernate on JBoss AS 7
            wqe wqe Newbie

            In the official spring integration guide ,section 2.1.1. Define a Resource and section 2.1.1.5. Define KnowledgeSessions mentions it .

             

            You should have something look like :

             

            <drools:kbase id="kbase">
            <drools:resources>
            <drools:resource type="BPMN2" source="classpath:SampleHumanTaskProcess.bpmn" />
            </drools:resources>
            </drools:kbase>

             

             

             

            <drools:ksession id="ksession" type="stateful" kbase="kbase">
            <drools:configuration>
            <drools:jpa-persistence>
            <drools:transaction-manager ref="jbpmTransactionManager" />
            <drools:entity-manager-factory ref="jbpmRuntimeEmf" />
            </drools:jpa-persistence>
            </drools:configuration>
            </drools:ksession>
            • 4. Re: JBPM(Human Task)+Spring+Hibernate on JBoss AS 7
              Avneesh Sisodia Newbie

              Yes I have all thses kbase and ksession etc. in my application context.

              here is my applicationContext.xml

               

               

              <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
                      <property name="transactionManagerName" value="java:jboss/TransactionManager"/>
                  </bean>
                  
                  <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
                      <property name="jndiName" value="java:jboss/datasources/RI"/>
                  </bean>
                  
                  <tx:annotation-driven transaction-manager="transactionManager" />    
                  
                  <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                      <property name="showSql" value="true" />
                      <!-- <property name="database" value="MSSQL" /> -->
                      <property name="generateDdl" value="true" />
                  </bean>
              
                  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
                      <property name="persistenceUnitName" value="jbpm" />
                      <property name="dataSource" ref="dataSource" />
                      <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
                  </bean>
                  
                  <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory" factory-method="getSystemEventListener" />
              
                  <bean id="taskService" class="org.jbpm.task.service.TaskService" >
                      <property name="systemEventListener" ref="systemEventListener" />
                  </bean>
              
                  <bean id="springTaskSessionFactory" class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl" scope="prototype">
                      <property name="entityManagerFactory" ref="entityManagerFactory" />
                      <property name="useJTA" value="true" />
                      <property name="taskService" ref="taskService" />
                  </bean>
                  
                  <bean id="taskServiceSetup" class="com.nijhazer.jbpm.quickstart.TaskServiceSetup" init-method="initialize">
                        <!-- <constructor-arg type="org.jbpm.task.service.TaskService" value="taskService" />
                      <constructor-arg type="org.springframework.transaction.support.AbstractPlatformTransactionManager" value="transactionManager" />
                         -->
                        <property name="taskService" ref="taskService" />
                        <property name="taskResources" ref="taskResourceFactory" />
                        <property name="roles" ref="listRoles" />
                        <property name="users" ref="listUsers" /> 
                  </bean>
                  
                  <bean id="taskResourceFactory" class="com.nijhazer.jbpm.quickstart.TaskResourceFactory" factory-method="getTaskClient">
                    <constructor-arg type="org.jbpm.task.service.TaskService" value="taskService" />
                    <constructor-arg type="org.springframework.transaction.support.AbstractPlatformTransactionManager" value="transactionManager" /> 
                       
                  </bean>
                  
                  <bean id="roleAdmin" class="com.nijhazer.jbpm.quickstart.model.AccountRole">
                      <constructor-arg type="java.lang.String" value="Administrator" />
                  </bean>
                  
                  <bean id="roleNormal" class="com.nijhazer.jbpm.quickstart.model.AccountRole">
                      <constructor-arg type="java.lang.String" value="Normal" />
                  </bean>
                  
                  <bean id="listRoles" class="java.util.ArrayList">
                      <constructor-arg>
                          <list>
                              <ref bean="roleAdmin" />
                              <ref bean="roleNormal" />
                          </list>
                      </constructor-arg>
                  </bean>
                  
                  <bean id="listUsers" class="java.util.ArrayList">
                      <constructor-arg>
                          <list>
                              <bean class="com.nijhazer.jbpm.quickstart.model.AccountUser">
                                  <constructor-arg type="java.lang.String" value="Administrator" />
                                  <constructor-arg type="com.nijhazer.jbpm.quickstart.model.AccountRole" ref="roleAdmin" />
                              </bean>
                              <bean class="com.nijhazer.jbpm.quickstart.model.AccountUser">
                                  <constructor-arg type="java.lang.String" value="NormalGuy" />
                                  <constructor-arg type="com.nijhazer.jbpm.quickstart.model.AccountRole" ref="roleNormal" />
                              </bean>
                          </list>
                      </constructor-arg>
                  </bean>
                  
                  <jbpm:kbase id="kbase">
                      <jbpm:resources>
                          <jbpm:resource source="classpath:bpmn/SampleHumanTaskProcess.bpmn" type="BPMN2"></jbpm:resource>
                      </jbpm:resources>
                  </jbpm:kbase>
                  
                  <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
                     <property name="entityManagerFactory" ref="entityManagerFactory" />
                  </bean>
                  
                  <bean id="ksessionFactory" class="com.nijhazer.jbpm.quickstart.KnowledgeSessionFactory">
                      <property name="entityManagerFactory" ref="entityManagerFactory" />
                      <property name="kbase" ref="kbase" />
                      <property name="transactionManager" ref="transactionManager" />
                      <property name="taskResources" ref="taskResourceFactory" />
                  </bean>
                  
                  <drools:ksession id="ksession" type="stateful" kbase="kbase">
                      <drools:configuration>
                          <drools:jpa-persistence>
                              <drools:transaction-manager ref="txManager" />
                              <drools:entity-manager-factory ref="entityManagerFactory" />
                          </drools:jpa-persistence>
                      </drools:configuration>
                  </drools:ksession>
                  
                  <!-- Component scan  -->
                  <context:component-scan base-package="com.nijhazer.jbpm.quickstart" />