Jbpm 4.4とspringは一体化しています.
注:実現中にSpringのバージョンが採用されたのは3.0.1の統合テストの時です. jbpmの構成 Springの構成 テスト 試験結果コンソール出力情報
tried to access method org.springframework.orm.hibernate3.SessionFactoryBuil......
の異常情報は最後に2.5のバージョンに変更すればいいです.<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<!--
jbpm spring , spring
<import resource="jbpm.tx.hibernate.cfg.xml" />
-->
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<!-- Job executor is excluded for running the example test cases. -->
<!-- To enable timers and messages in production use, this should be included. -->
<!--
<import resource="jbpm.jobexecutor.cfg.xml" />
-->
</jbpm-configuration>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
<property name="jbpmCfg" value="jbpm.cfg.xml"></property>
</bean>
<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/jbpm" />
<property name="username" value="root" />
<property name="password" value="162838" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name = "hibernateProperties" >
<props >
<prop key = "hibernate.dialect" > org.hibernate.dialect.MySQLInnoDBDialect </prop >
<prop key = "hibernate.show_sql" > true </prop >
<prop key = "hibernate.format_sql" > true </prop >
<prop key = "hibernate.hbm2ddl.auto" > update </prop >
</props >
</property >
<property name = "mappingLocations" >
<list >
<value > classpath:jbpm.execution.hbm.xml </value >
<value > classpath:jbpm.history.hbm.xml </value >
<value > classpath:jbpm.identity.hbm.xml </value >
<value > classpath:jbpm.repository.hbm.xml </value >
<value > classpath:jbpm.task.hbm.xml </value >
</list >
</property >
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
@Test
public void testSpring(){
try {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
ProcessEngine pe = (ProcessEngine) ac.getBean("processEngine");
HistoryService hs = pe.getHistoryService();
//
List<HistoryProcessInstance> hpis = hs.createHistoryProcessInstanceQuery().processDefinitionId("demo-1").list();
for (HistoryProcessInstance historyProcessInstance : hpis) {
System.out.println(historyProcessInstance.getProcessInstanceId());
}
} catch (BeansException e) {
e.printStackTrace();
}
}
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
15:28:59,070 FIN | [WireContext] eagerly initializing org.jbpm.pvm.internal.id.DatabaseIdComposer
Hibernate:
select
propertyim0_.KEY_ as KEY1_14_,
propertyim0_.VERSION_ as VERSION2_14_,
propertyim0_.VALUE_ as VALUE3_14_
from
JBPM4_PROPERTY propertyim0_ limit ?
Hibernate:
select
propertyim0_.KEY_ as KEY1_14_0_,
propertyim0_.VERSION_ as VERSION2_14_0_,
propertyim0_.VALUE_ as VALUE3_14_0_
from
JBPM4_PROPERTY propertyim0_
where
propertyim0_.KEY_=?
15:29:05,282 INF | [CheckDbCmd] jBPM version info: library[4.4-SNAPSHOT], schema[null]
Hibernate:
select
historypro0_.DBID_ as DBID1_4_,
historypro0_.DBVERSION_ as DBVERSION2_4_,
historypro0_.ID_ as ID3_4_,
historypro0_.PROCDEFID_ as PROCDEFID4_4_,
historypro0_.KEY_ as KEY5_4_,
historypro0_.START_ as START6_4_,
historypro0_.END_ as END7_4_,
historypro0_.DURATION_ as DURATION8_4_,
historypro0_.STATE_ as STATE9_4_,
historypro0_.ENDACTIVITY_ as ENDACTI10_4_,
historypro0_.NEXTIDX_ as NEXTIDX11_4_
from
JBPM4_HIST_PROCINST historypro0_
where
historypro0_.PROCDEFID_='demo-1'
// ID
demo.60007
demo.70001
demo.80001