Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
jbpm getting started Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jbpm getting started

    I have been able to download and build the jbpm 31 integration.

    I have looked but cannot find any examples of setting up an engine which I can use withing my application. Does anyone have a 'Hello World' example which includes the applicationContext.xml ?

    Thanks,
    Craig

  • #2
    There isn't any sample for jbpm at the moment. I'll try to make one or migrate an existing one from plain jbpm to spring jbpm support. You can take a look at the tests which contain application context definitions. Can you also please, raise an issue on jira under spring modules? thanks.

    Comment


    • #3
      thanks for the hints Costin.

      i raised the jira issue as asked.

      I have looked at the tests, but cannot figure out how to set up the factorybean.

      I would like to pass in a mysql connection for the hibernate. I know how to set up transaction managers, and a mysql connection...but, how would I configure it to use a specific database, with the default hbm files?

      Here is what I have in my application context...it fails in the afterPropertiesSet...I am not sure which of the two configuration methods to use (JbpmConfiguration, or ObjectFactory)

      any help would be much appreciated.

      craig


      <bean id="jbpmSessionFactoryBean" class="org.springmodules.workflow.jbpm31.LocalJbpm ConfigurationFactoryBean">
      <!-- <property name="hibernateSessionFactory" ref="mySessionFactory"/> -->
      </bean>

      <bean id="processDefinition" class="org.springmodules.workflow.jbpm31.definitio n.ProcessDefinitionFactoryBean">
      <property name="jbpmSessionFactory" ref="jbpmSessionFactoryBean"/>
      <property name="definitionLocation" value="classpath:/demo-process.xml"/>
      </bean>

      <bean id="jbpmDataSource" class="org.apache.commons.dbcp.BasicDataSource"
      destroy-method="close">
      <property name="driverClassName">
      <value>com.mysql.jdbc.Driver</value>
      </property>
      <property name="url">
      <value>jdbc:mysql://localhost/jbpm</value>
      </property>
      <property name="username">
      <value>${jdbc.user}</value>
      </property>
      <property name="password">
      <value>${jdbc.password}</value>
      </property>
      </bean>

      Comment


      • #4
        What's the message? Have you looked at the generated javadocs?

        Comment


        • #5
          Yup, I have read it all.

          I also tried this:

          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:aop="http://www.springframework.org/schema/aop"
          xsi:schemaLocation=
          "http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans.xsd">

          <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
          <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
          <property name="url" value="jdbc:mysql://localhost/jbpm"/>
          <property name="username" value="aaaaa"/>
          <property name="password" value="xxxxxx"/>
          </bean>

          <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
          <property name="dataSource">
          <ref bean="dataSource"/>
          </property>
          <property name="mappingLocations">
          <value>classpath*:/org/jbpm/**/*.hbm.xml</value>
          </property>
          <property name="hibernateProperties">
          <props>
          <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
          <prop key="hibernate.show_sql">true</prop>
          </props>
          </property>
          <property name="schemaUpdate" value="true"/>
          </bean>

          <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
          <property name="sessionFactory" ref="hibernateSessionFactory"/>
          </bean>

          <bean id="hibernateConfiguration" factory-bean="hibernateSessionFactory" factory-method="getConfiguration"/>

          <bean id="jbpmSessionFactory" class="org.springmodules.workflow.jbpm31.LocalJbpm ConfigurationFactoryBean">
          <property name="hibernateSessionFactory" ref="hibernateSessionFactory"/>
          <property name="hibernateConfiguration" ref="hibernateConfiguration"/>
          </bean>

          <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTempl ate">
          <property name="jbpmSessionFactory" ref="jbpmSessionFactory"/>
          </bean>

          </beans>


          I get this error:
          ERROR web.context.ContextLoader - Context initialization failed
          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'hibernateConfiguration' defined in ServletContext resource [/WEB-INF/classes/jpbmContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionSt oreException: No factory method: factory bean=hibernateSessionFactory; factory method=getConfiguration
          org.springframework.beans.factory.BeanDefinitionSt oreException: No factory method: factory bean=hibernateSessionFactory; factory method=getConfiguration
          at org.springframework.beans.factory.support.Construc torResolver.instantiateUsingFactoryMethod(Construc torResolver.java:271)

          Comment


          • #6
            getting further...i had missed the &. However, if I call getConfiguration on the hibernate session factory the return type is Configuration....the LocalJbpmConfigurationFactoryBean has a method setConfiguration, but is expecting resource.

            I don't see what I should be setting, setObjectFactory, or setConfiguration.

            Comment


            • #7
              Ok, now I am getting there. I hadn't seen the applicationContext which was in the testing folder, i had looked in the source package.

              That has all the information I need to set it up properly.

              Comment


              • #8
                I hadn't seen the applicationContext which was in the testing folder
                That's what I meant by tests. jbpm 3.1 support is different from jbpm 3.0 since jbpm itself has been modified quite a lot. Even though there are some similarities the classes and underlying architecture has changed - one aspect would be that you don't need to pass in a Hibernate configuration.

                Comment


                • #9
                  Originally posted by craig
                  Ok, now I am getting there. I hadn't seen the applicationContext which was in the testing folder, i had looked in the source package.

                  That has all the information I need to set it up properly.
                  where is the testing folder your refering to here?

                  Comment


                  • #10
                    inside the springmodules 0.3 distribution and the latest version on the spring modules cvs.

                    Comment


                    • #11
                      progress w/jbpm and spring

                      Here's how I am incorporating jBPM 3.1 into an existing Hibernate3/Spring app. My goal is to have a single SessionFactory for jBPM and the rest of my app, so everything participates in the same Spring declarative transactions.

                      - add jbpm-3.1.1.jar to WEB-INF/lib.
                      - in applicationContext.xml, I created a bean for JbpmConfiguration

                      <bean id="jbpmConfig"
                      class="org.springmodules.workflow.jbpm31.LocalJbpm ConfigurationFactoryBean">
                      <!-- pass in existing sessionFactory -->
                      <property name="sessionFactory" ref="sessionFactory"/>
                      <property name="configuration" value="WEB-INF/jbpm.cfg.xml"/>
                      <property name="processDefinitions">
                      <list>
                      <ref local="process1"/>
                      </list>
                      </property>
                      </bean>

                      <bean id="process1" class="org.springmodules.workflow.jbpm31.definitio n.ProcessDefinitionFactoryBean">
                      <property name="definitionLocation" value="WEB-INF/process1.xml"/>
                      </bean>

                      - sessionFactory/hibernate configuration has to incorporate all of the jBPM org.jbpm.....hbm.xml mappings *and*your own.

                      - jbpm.cfg.xml copy-pasted from jBPM docs, but I took out reference to hibernate.cfg.xml since the SessionFactory is being provided via Spring.

                      - process defs (process1.xml etc.) are normal.

                      - you have to create the DB tables yourself somehow.

                      Only problem: it seems like this is causing a new version of each process to be redeployed to the jbpm_processdefinition table every time the app is restarted. This seems a little odd, and may make the Spring-based process deployment less useful.

                      Comment


                      • #12
                        Only problem: it seems like this is causing a new version of each process to be redeployed to the jbpm_processdefinition table every time the app is restarted. This seems a little odd, and may make the Spring-based process deployment less useful.
                        Do you have any idea what causes this redeployment? Is it caused by Spring integration? Can you please raise an issue on jira so I can take a look at it and fix it on our next Spring Modules release?
                        Thanks.

                        Comment


                        • #13
                          Originally posted by Costin Leau
                          Do you have any idea what causes this redeployment? Is it caused by Spring integration? Can you please raise an issue on jira so I can take a look at it and fix it on our next Spring Modules release?
                          Thanks.
                          Wow, thanks for the quick reply. now that's service!

                          Honestly, I have no idea why this is happening. I'm new to jBPM, and right now focused on just getting the basic configuration and db connection/tx mgmt right.

                          I'm not sure what ProcessDefinitionFactoryBean does. Here's my process1.xml in case there's something unusual here:
                          Code:
                          <process-definition name="process1">
                            <start-state>
                              <transition to='s' />
                            </start-state>
                            <state name='s'>
                              <transition to='end'/>
                            </state>
                            <end-state name='end' />
                          </process-definition>

                          Comment


                          • #14
                            Your process seems to be just fine. What jbpm version are you using? Lately I've been a bit swamped in work and I didn't have much time to do the jbpm documentation but it's high on my Spring Modules priority list (you can actually vote the jira issue).
                            I'll try to reproduce your problem though from my tests I haven't had such a problem.

                            Comment


                            • #15
                              Originally posted by Costin Leau
                              Your process seems to be just fine. What jbpm version are you using? Lately I've been a bit swamped in work and I didn't have much time to do the jbpm documentation but it's high on my Spring Modules priority list (you can actually vote the jira issue).
                              I'll try to reproduce your problem though from my tests I haven't had such a problem.
                              I'm using jbpm 3.1.1.

                              Comment

                              Working...
                              X