4 Replies Latest reply on Jul 13, 2011 10:30 PM by RuiHua Tang

    jBPM 5.1 with Spring mvc

    Sameer Kumar Newbie

      Hi,

       

      I downloaded jBPM5.1 full installer and could successfully execute the sample web-console example provided.

       

      I need to understand how jBPM5.1 works with Spring MVC.

      Request people to kindly share one working simple workflow step by step.

       

      Could not find any demo spring integration example in web.

       

      Regards,

      Sam

        • 1. Re: jBPM 5.1 with Spring mvc
          Sameer Kumar Newbie

          It will be really great if jBPM Team could provide a sample Spring mvc integrated example. This is really missing here.

          • 2. Re: jBPM 5.1 with Spring mvc
            bpmn2user Expert

            jBPM is agnostic to any UI framework you want to use, i.e, it does not matter if you use Spring MVC, Struts, JSF, Swing, GWT etc. You can use jBPM API from any framework you like.

             

            Here are some examples to see how the jBPM API is used. You can  have the API calls from your Spring MVC framework.

            http://docs.jboss.org/jbpm/v5.1/userguide/ch08.html#d0e2894

            http://sourceforge.net/projects/jbpm/files/jBPM%205/jbpm-5.1.0.Final/jbpm-5.1.0.Final-examples.zip/download

            • 3. Re: jBPM 5.1 with Spring mvc
              RuiHua Tang Newbie

              I found that using the spring to manage the transaction for jbpm5 ,what seems to be incorrect.

               

              here is my code:

               

              persistent.xml:
              <persistence-unit name="org.jbpm.persistence.jpa"
                                  transaction-type="RESOURCE_LOCAL">
              
              code :
              EntityManagerFactory emf = (EntityManagerFactory) Constants.ctx.getBean("entityManagerFactory");
              Environment env = KnowledgeBaseFactory.newEnvironment();
                             env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
                             env.set(EnvironmentName.TRANSACTION_MANAGER, Constants.ctx.getBean("txManager"));
              StatefulKnowledgeSession session = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
              
              applicationContext.xml:
              
              
              
              <context:annotation-config />
              
              
              <bean id="dataSource"
              
              
              class="org.springframework.jdbc.datasource.DriverManagerDataSource">
              
              
              <property name="driverClassName" value="oracle.jdbc.OracleDriver" />
              
              
              <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
              
              
              <property name="username" value="jbpm" />
              
              
              <property name="password" value="jbpm" />
              
              
              </bean>
              
              
              <bean id="entityManagerFactory"
              
              
              class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
              
              
              <property name="persistenceUnitName" value="org.jbpm.persistence.jpa"></property>
              
              
              <property name="dataSource" ref="dataSource"></property>
              
              
              <property name="jpaVendorAdapter">
              
              
              <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
              
              
              <property name="database" value="ORACLE" />
              
              
              <property name="showSql" value="true" />
              
              
              </bean>
              
              
              </property>
              
              
              </bean>
              
              
              
              
              
              
              <bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
              
              
              <property name="entityManagerFactory" ref="entityManagerFactory" />
              
              
              </bean>
              
              
              
              
              
              
              <tx:annotation-driven transaction-manager="txManager" />
              
              
              
              
              

               

              The result is i can't start the second task.

               

              You can use the following link to view details:

               

              http://community.jboss.org/thread/168666

              • 4. Re: jBPM 5.1 with Spring mvc
                RuiHua Tang Newbie

                Does anyone can solve the problem?