Announcement Announcement Module
Collapse
No announcement yet.
jbpm setup through spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jbpm setup through spring

    Hi,
    I'm trying to perform a complete (HibernateLocalSession, TrxMan, DataSource) setup of JBPM through spring xml config file.
    I'm trying to leave out jbpm.properties for a spring-only managed setup.
    I'm a newbie so I cannot successfully complete this apparently simple task.
    The other topics I found in the forum did not help me, so I decided to put this post.
    Thank's a lot for any information you could give to me.

    This is the relevant config file:

    Code:
    <beans>
    
    	<bean
    		id="dataSource-postgres"
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName">
    			<value>org.postgresql.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc&#58;postgresql&#58;//localhost&#58;5432/MyDB_001</value>
    		</property>
    		<property name="username">
    			<value>*******</value>
    		</property>
    		<property name="password">
    			<value>*******</value>
    		</property>
    	</bean>
    
    	<bean
    		id="myAppSessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource" >
    			<ref bean="dataSource-postgres" />
    		</property>
    		<property name="mappingResources">
    			<list>
    				<!--identity mapping files -->
    				<!-- uncomment if you don't want to use the default jBPM identity mgmgt component -->
    				<value>org/jbpm/identity/User.hbm.xml</value>
    				<value>
    					org/jbpm/identity/Group.hbm.xml
    				</value>
    				<value>
    					org/jbpm/identity/Membership.hbm.xml
    				</value>
    
    				<!-- graph.def mapping files -->
    				<value>
    					org/jbpm/graph/def/ProcessDefinition.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/def/Node.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/def/Transition.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/def/Event.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/def/Action.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/def/SuperState.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/def/ExceptionHandler.hbm.xml
    				</value>
    				<value>
    					org/jbpm/instantiation/Delegation.hbm.xml
    				</value>
    
    				<!-- graph.node mapping files -->
    				<value>
    					org/jbpm/graph/node/StartState.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/EndState.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/ProcessState.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/Decision.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/Fork.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/Join.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/State.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/node/TaskNode.hbm.xml
    				</value>
    
    				<!-- graph.action mapping files -->
    				<value>
    					org/jbpm/graph/action/Script.hbm.xml
    				</value>
    
    				<!-- context.def mapping files -->
    				<value>
    					org/jbpm/context/def/ContextDefinition.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/def/VariableAccess.hbm.xml
    				</value>
    
    				<!-- taskmgmt.def mapping files -->
    				<value>
    					org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/def/Swimlane.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/def/Task.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/def/TaskController.hbm.xml
    				</value>
    
    				<!-- module.def mapping files -->
    				<value>
    					org/jbpm/module/def/ModuleDefinition.hbm.xml
    				</value>
    
    				<!-- bytes mapping files -->
    				<value>
    					org/jbpm/bytes/ByteArray.hbm.xml
    				</value>
    
    				<!-- file.def mapping files -->
    				<value>
    					org/jbpm/file/def/FileDefinition.hbm.xml
    				</value>
    
    				<!-- scheduler.def mapping files -->
    				<value>
    					org/jbpm/scheduler/def/CreateTimerAction.hbm.xml
    				</value>
    				<value>
    					org/jbpm/scheduler/def/CancelTimerAction.hbm.xml
    				</value>
    
    				<!-- graph.exe mapping files -->
    				<value>
    					org/jbpm/graph/exe/Comment.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/exe/ProcessInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/exe/Token.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/exe/RuntimeAction.hbm.xml
    				</value>
    
    				<!-- module.exe mapping files -->
    				<value>
    					org/jbpm/module/exe/ModuleInstance.hbm.xml
    				</value>
    
    				<!-- context.exe mapping files -->
    				<value>
    					org/jbpm/context/exe/ContextInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/TokenVariableMap.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/VariableInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml
    				</value>
    
    				<!-- taskmgmt.exe mapping files -->
    				<value>
    					org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/exe/PooledActor.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml
    				</value>
    
    				<!-- scheduler.exe mapping files -->
    				<value>
    					org/jbpm/scheduler/exe/Timer.hbm.xml
    				</value>
    
    				<!-- logging mapping files -->
    				<value>
    					org/jbpm/logging/log/ProcessLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/logging/log/MessageLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/logging/log/CompositeLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/ActionLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/NodeLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/SignalLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/TokenCreateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/TokenEndLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/graph/log/TransitionLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/VariableLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/VariableCreateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/VariableDeleteLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/VariableUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/TaskLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml
    				</value>
    				<value>
    					org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml
    				</value>
    			</list>
    		</property>
    
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.default_schema">myapp-jpbm</prop>
    				<prop key="hibernate.c3p0.min_size">1</prop>
    				<prop key="hibernate.c3p0.max_size">3</prop>
    			</props>
    		</property>
    	</bean>
    
    	<bean
    		id="myAppJbpmSessionFactory"
    		class="org.jbpm.db.JbpmSessionFactory"
    		singleton="true">
    		<constructor-arg>
    			<bean class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
    				<property name="targetBeanName">
    					<value>&amp;myAppSessionFactory</value>
    				</property>
    				<property name="propertyPath">
    					<value>configuration</value>
    				</property>
    			</bean>
    		</constructor-arg>
    		<constructor-arg ref="myAppSessionFactory" />
     	</bean>
    
    	<bean id="myAppJbpmSession"
    		factory-bean="myAppJbpmSessionFactory"
    		factory-method="openJbpmSession"
    		destroy-method="close"
    		singleton="false">
    	</bean>
    
    	<bean
    		id="myHelloWorldDbSetupWithSpringDI"
    		class="it.nikware.myapp.storage.workflow.test.HelloWorldDbSetupWithSpringDI">
    		<property
    			name="jbpmSessionFactory"
    			ref="myAppJbpmSessionFactory" />
    		<property
    			name="jbpmSession"
    			ref="myAppJbpmSession" />
    	</bean>
    
    	<bean
    		id="myHelloWorldDbWithSpringDI"
    		class="it.nikware.myapp.storage.workflow.test.HelloWorldDbWithSpringDI">
    		<property
    			name="jbpmSessionFactory"
    			ref="myAppJbpmSessionFactory" />
    		<property
    			name="jbpmSession"
    			ref="myAppJbpmSession" />
    	</bean>
    
    </beans>
    And this this the stack trace with others possibly relevant console output:

    Code:
    11&#58;19&#58;57,624 INFO  SessionFactoryImpl &#58; Checking 0 named queries
    11&#58;19&#58;57,684 INFO  AbstractBeanFactory &#58; Creating shared instance of singleton bean 'myAppJbpmSessio
    nFactory'
    11&#58;20&#58;20,237 DEBUG JbpmSessionFactory &#58; building hibernate session factory
    11&#58;20&#58;27,287 INFO  Configuration &#58; processing extends queue
    11&#58;20&#58;27,297 INFO  Configuration &#58; processing collection mappings
    11&#58;20&#58;27,297 INFO  Configuration &#58; processing association property references
    11&#58;20&#58;27,317 INFO  Configuration &#58; processing foreign key constraints
    11&#58;20&#58;27,377 INFO  ConnectionProviderFactory &#58; Initializing connection provider&#58; org.springframework
    .orm.hibernate3.LocalDataSourceConnectionProvider
    11&#58;20&#58;33,676 INFO  AbstractBeanFactory &#58; Destroying singletons in factory &#123;org.springframework.beans
    .factory.support.DefaultListableBeanFactory defining beans &#91;dataSource-postgres,myAppSessionFactory,
    myAppJbpmSessionFactory,myAppJbpmSession,myHelloWorldDbSetupWithSpringDI,myHelloWorldDbWithSpringDI&#93;
    ; root of BeanFactory hierarchy&#125;
    11&#58;20&#58;33,686 INFO  LocalSessionFactoryBean &#58; Closing Hibernate SessionFactory
    11&#58;20&#58;33,686 INFO  SessionFactoryImpl &#58; closing
    FAILED&#58; it.nikware.myapp.storage.workflow.test.HelloWorldDbWithSpringDITest.setUp&#40;&#41;
    org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'myAppJbpmSes
    sionFactory' defined in class path resource &#91;it/nikware/myapp/storage/conf/helloWorldDbTest.spring.x
    ml&#93;&#58; Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException&#58;
     Could not instantiate class &#91;org.jbpm.db.JbpmSessionFactory&#93;; constructor threw exception; nested e
    xception is org.hibernate.HibernateException&#58; No local DataSource found for configuration - dataSour
    ce property must be set on LocalSessionFactoryBean
    org.springframework.beans.FatalBeanException&#58; Could not instantiate class &#91;org.jbpm.db.JbpmSessionFa
    ctory&#93;; constructor threw exception; nested exception is org.hibernate.HibernateException&#58; No local 
    DataSource found for configuration - dataSource property must be set on LocalSessionFactoryBean
    org.hibernate.HibernateException&#58; No local DataSource found for configuration - dataSource property 
    must be set on LocalSessionFactoryBean
    	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.configure&#40;LocalDataSourceCo
    nnectionProvider.java&#58;48&#41;
    	at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider&#40;ConnectionProviderFacto
    ry.java&#58;80&#41;
    	at org.hibernate.cfg.SettingsFactory.createConnectionProvider&#40;SettingsFactory.java&#58;362&#41;
    	at org.hibernate.cfg.SettingsFactory.buildSettings&#40;SettingsFactory.java&#58;60&#41;
    	at org.hibernate.cfg.Configuration.buildSettings&#40;Configuration.java&#58;1463&#41;
    	at org.hibernate.cfg.Configuration.buildSessionFactory&#40;Configuration.java&#58;1004&#41;
    	at org.jbpm.db.JbpmSessionFactory.buildSessionFactory&#40;JbpmSessionFactory.java&#58;138&#41;
    	at org.jbpm.db.JbpmSessionFactory.<init>&#40;JbpmSessionFactory.java&#58;77&#41;
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0&#40;Native Method&#41;
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance&#40;NativeConstructorAccessorImpl.java&#58;39&#41;
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance&#40;DelegatingConstructorAccessorImpl.java
    &#58;27&#41;
    	at java.lang.reflect.Constructor.newInstance&#40;Constructor.java&#58;494&#41;
    	at org.springframework.beans.BeanUtils.instantiateClass&#40;BeanUtils.java&#58;100&#41;
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate&#40;SimpleInstanti
    ationStrategy.java&#58;75&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor
    &#40;AbstractAutowireCapableBeanFactory.java&#58;669&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;Abstract
    AutowireCapableBeanFactory.java&#58;329&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;2
    26&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;1
    47&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;De
    faultListableBeanFactory.java&#58;275&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContex
    t.java&#58;318&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicatio
    nContext.java&#58;81&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicatio
    nContext.java&#58;66&#41;
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>&#40;ClassPathXmlApplicatio
    nContext.java&#58;57&#41;
    	at it.nikware.myapp.storage.workflow.test.HelloWorldDbWithSpringDITest.setUp&#40;HelloWorldDbWithSpring
    DITest.java&#58;29&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
    	at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41;
    	at org.testng.internal.MethodHelper.invokeMethod&#40;MethodHelper.java&#58;306&#41;
    	at org.testng.internal.Invoker.invokeConfigurationMethod&#40;Invoker.java&#58;282&#41;
    	at org.testng.internal.Invoker.invokeConfigurations&#40;Invoker.java&#58;151&#41;
    	at org.testng.internal.Invoker.invokeMethod&#40;Invoker.java&#58;316&#41;
    	at org.testng.internal.Invoker.invokeTestMethods&#40;Invoker.java&#58;490&#41;
    	at org.testng.internal.TestMethodWorker.run&#40;TestMethodWorker.java&#58;61&#41;
    	at org.testng.TestRunner.privateRun&#40;TestRunner.java&#58;585&#41;
    	at org.testng.TestRunner.run&#40;TestRunner.java&#58;480&#41;
    	at org.testng.SuiteRunner.privateRun&#40;SuiteRunner.java&#58;191&#41;
    	at org.testng.SuiteRunner.run&#40;SuiteRunner.java&#58;117&#41;
    	at org.testng.eclipse.runner.RemoteTestNG.run&#40;RemoteTestNG.java&#58;99&#41;
    	at org.testng.eclipse.runner.RemoteTestNG.main&#40;RemoteTestNG.java&#58;138&#41;

  • #2
    Hey,

    You need to try the spring-jbpm module. Right now its in spring-projects/spring-jbpm in the main springframework CVS.

    I've been using it with great results.

    Comment

    Working...
    X