[jboss-user] [JBoss jBPM] - jBpm and Spring wiring

ofomin do-not-reply at jboss.com
Tue Apr 22 14:53:15 EDT 2008


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">
  |               <list>
  |                 <value>org/jbpm/graph/action/Script.hbm.xml</value>
  |               <!-- Write here your list of Hibernate files -->
  |                 <value>org/jbpm/db/hibernate.queries.hbm.xml</value>
  |                                                         <!-- value>org/jbpm/graph/action/MailAction.hbm.xml"</value-->
  |                                                     
  |                                                     <!-- graph.def mapping files -->
  |                                                         <value>org/jbpm/graph/def/ProcessDefinition.hbm.xml</value>
  |   </bean>
  | 
  |     <bean id="jbpmConfiguration" 
  |                               class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
  |                             <property name="sessionFactory" ref="hibernateSessionFactory"/>
  |         <property name="configuration" value="classpath:/jbpm.cfg.xml"/>                        
  |                             <property name="createSchema" value="false"/>
  | 
  |     </bean>
  | 

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 


  | <jbpm-configuration>
  |   <jbpm-context>
  |     <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" />
  |   </jbpm-context>
  | 
  |   <!-- 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 ...

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4145969#4145969

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4145969



More information about the jboss-user mailing list