2 Replies Latest reply on Apr 23, 2008 4:40 PM by Ronald van Kuijk

    jBpm and Spring wiring

    Oleg Fomin Newbie

      I currently trying to wire jBpm through Spring using springmodules jBpm31 ver 0.9 (https://springmodules.dev.java.net/docs/reference/0.6/html/jbpm31.htm) and I am having two burning issues:
      First issue is as strange as it seems to get the stuff to work I have to configure two data sources in both spring and hibernate.

      Spring config reads as:

       <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
       <property name="dataSource" ref="dataSource"/>
       <property name="mappingResources">
       <!-- Write here your list of Hibernate files -->
       <!-- value>org/jbpm/graph/action/MailAction.hbm.xml"</value-->
       <!-- graph.def mapping files -->
       <bean id="jbpmConfiguration"
       <property name="sessionFactory" ref="hibernateSessionFactory"/>
       <property name="configuration" value="classpath:/jbpm.cfg.xml"/>
       <property name="createSchema" value="false"/>

      Please note that the jbpmConfiguration bean has a reference to a jbpm.cfg.xml which as in default case got the reference to hibernate.cfg.xml

       <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
       <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
       <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
       <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
       <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
       <!-- configuration property used by persistence service impl org.jbpm.persistence.db.DbPersistenceServiceFactory -->
       <string name="resource.hibernate.cfg.xml" value="hibernate.cfg.xml" />

      Second issue is that if I run one junit test extened from AbstractDependencyInjectionSpringContextTests everything goes well but if I try to run two or more consecutive tests in a row I am getting a nasty exception like:
      Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: a beanFactoryReference already exists for key jbpmConfiguration

      Any input on these issues is appreciated ...