`
man1900
  • 浏览: 431969 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

在Spring应用中引入Jbpm4开发应用

    博客分类:
  • JBPM
阅读更多

1.       执行创建的脚本

create table JBPM4_DEPLOYMENT (

        DBID_ bigint not null auto_increment,

        NAME_ longtext,

        TIMESTAMP_ bigint,

        STATE_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_DEPLOYPROP (

        DBID_ bigint not null auto_increment,

        DEPLOYMENT_ bigint,

        OBJNAME_ varchar(255),

        KEY_ varchar(255),

        STRINGVAL_ varchar(255),

        LONGVAL_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_EXECUTION (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        ACTIVITYNAME_ varchar(255),

        PROCDEFID_ varchar(255),

        HASVARS_ bit,

        NAME_ varchar(255),

        KEY_ varchar(255),

        ID_ varchar(255) unique,

        STATE_ varchar(255),

        SUSPHISTSTATE_ varchar(255),

        PRIORITY_ integer,

        HISACTINST_ bigint,

        PARENT_ bigint,

        INSTANCE_ bigint,

        SUPEREXEC_ bigint,

        SUBPROCINST_ bigint,

        PARENT_IDX_ integer,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_ACTINST (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        HPROCI_ bigint,

        TYPE_ varchar(255),

        EXECUTION_ varchar(255),

        ACTIVITY_NAME_ varchar(255),

        START_ datetime,

        END_ datetime,

        DURATION_ bigint,

        TRANSITION_ varchar(255),

        NEXTIDX_ integer,

        HTASK_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_DETAIL (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        USERID_ varchar(255),

        TIME_ datetime,

        HPROCI_ bigint,

        HPROCIIDX_ integer,

        HACTI_ bigint,

        HACTIIDX_ integer,

        HTASK_ bigint,

        HTASKIDX_ integer,

        HVAR_ bigint,

        HVARIDX_ integer,

        MESSAGE_ longtext,

        OLD_INT_ integer,

        NEW_INT_ integer,

        OLD_STR_ varchar(255),

        NEW_STR_ varchar(255),

        OLD_TIME_ datetime,

        NEW_TIME_ datetime,

        PARENT_ bigint,

        PARENT_IDX_ integer,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_PROCINST (

        DBID_ bigint not null,

        DBVERSION_ integer not null,

        ID_ varchar(255),

        PROCDEFID_ varchar(255),

        KEY_ varchar(255),

        START_ datetime,

        END_ datetime,

        DURATION_ bigint,

        STATE_ varchar(255),

        ENDACTIVITY_ varchar(255),

        NEXTIDX_ integer,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_TASK (

        DBID_ bigint not null,

        DBVERSION_ integer not null,

        EXECUTION_ varchar(255),

        OUTCOME_ varchar(255),

        ASSIGNEE_ varchar(255),

        PRIORITY_ integer,

        STATE_ varchar(255),

        CREATE_ datetime,

        END_ datetime,

        DURATION_ bigint,

        NEXTIDX_ integer,

        SUPERTASK_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_HIST_VAR (

        DBID_ bigint not null,

        DBVERSION_ integer not null,

        PROCINSTID_ varchar(255),

        EXECUTIONID_ varchar(255),

        VARNAME_ varchar(255),

        VALUE_ varchar(255),

        HPROCI_ bigint,

        HTASK_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_ID_GROUP (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        ID_ varchar(255),

        NAME_ varchar(255),

        TYPE_ varchar(255),

        PARENT_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_ID_MEMBERSHIP (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        USER_ bigint,

        GROUP_ bigint,

        NAME_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_ID_USER (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        ID_ varchar(255),

        PASSWORD_ varchar(255),

        GIVENNAME_ varchar(255),

        FAMILYNAME_ varchar(255),

        BUSINESSEMAIL_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_JOB (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        DUEDATE_ datetime,

        STATE_ varchar(255),

        ISEXCLUSIVE_ bit,

        LOCKOWNER_ varchar(255),

        LOCKEXPTIME_ datetime,

        EXCEPTION_ longtext,

        RETRIES_ integer,

        PROCESSINSTANCE_ bigint,

        EXECUTION_ bigint,

        CFG_ bigint,

        SIGNAL_ varchar(255),

        EVENT_ varchar(255),

        REPEAT_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_LOB (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        BLOB_VALUE_ longblob,

        DEPLOYMENT_ bigint,

        NAME_ longtext,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_PARTICIPATION (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        GROUPID_ varchar(255),

        USERID_ varchar(255),

        TYPE_ varchar(255),

        TASK_ bigint,

        SWIMLANE_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_SWIMLANE (

        DBID_ bigint not null auto_increment,

        DBVERSION_ integer not null,

        NAME_ varchar(255),

        ASSIGNEE_ varchar(255),

        EXECUTION_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_TASK (

        DBID_ bigint not null auto_increment,

        CLASS_ char(1) not null,

        DBVERSION_ integer not null,

        NAME_ varchar(255),

        DESCR_ longtext,

        STATE_ varchar(255),

        SUSPHISTSTATE_ varchar(255),

        ASSIGNEE_ varchar(255),

        FORM_ varchar(255),

        PRIORITY_ integer,

        CREATE_ datetime,

        DUEDATE_ datetime,

        PROGRESS_ integer,

        SIGNALLING_ bit,

        EXECUTION_ID_ varchar(255),

        ACTIVITY_NAME_ varchar(255),

        HASVARS_ bit,

        SUPERTASK_ bigint,

        EXECUTION_ bigint,

        PROCINST_ bigint,

        SWIMLANE_ bigint,

        TASKDEFNAME_ varchar(255),

        primary key (DBID_)

    ) type=InnoDB;

 

    create table JBPM4_VARIABLE (

        DBID_ bigint not null auto_increment,

        CLASS_ varchar(255) not null,

        DBVERSION_ integer not null,

        KEY_ varchar(255),

        CONVERTER_ varchar(255),

        HIST_ bit,

        EXECUTION_ bigint,

        TASK_ bigint,

        DATE_VALUE_ datetime,

        DOUBLE_VALUE_ double precision,

        LONG_VALUE_ bigint,

        STRING_VALUE_ varchar(255),

        TEXT_VALUE_ longtext,

        LOB_ bigint,

        EXESYS_ bigint,

        primary key (DBID_)

    ) type=InnoDB;

 

    create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);

 

    alter table JBPM4_DEPLOYPROP

        add index FK_DEPLPROP_DEPL (DEPLOYMENT_),

        add constraint FK_DEPLPROP_DEPL

        foreign key (DEPLOYMENT_)

        references JBPM4_DEPLOYMENT (DBID_);

 

    create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);

 

    create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);

 

    create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);

 

    create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_PARENT (PARENT_),

        add constraint FK_EXEC_PARENT

        foreign key (PARENT_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_SUBPI (SUBPROCINST_),

        add constraint FK_EXEC_SUBPI

        foreign key (SUBPROCINST_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_INSTANCE (INSTANCE_),

        add constraint FK_EXEC_INSTANCE

        foreign key (INSTANCE_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_EXECUTION

        add index FK_EXEC_SUPEREXEC (SUPEREXEC_),

        add constraint FK_EXEC_SUPEREXEC

        foreign key (SUPEREXEC_)

        references JBPM4_EXECUTION (DBID_);

 

    create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);

 

    create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);

 

    alter table JBPM4_HIST_ACTINST

        add index FK_HACTI_HPROCI (HPROCI_),

        add constraint FK_HACTI_HPROCI

        foreign key (HPROCI_)

        references JBPM4_HIST_PROCINST (DBID_);

 

    alter table JBPM4_HIST_ACTINST

        add index FK_HTI_HTASK (HTASK_),

        add constraint FK_HTI_HTASK

        foreign key (HTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);

 

    create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);

 

    create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);

 

    create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);

 

    create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);

 

    create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);

 

    create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);

 

    create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HPROCI (HPROCI_),

        add constraint FK_HDETAIL_HPROCI

        foreign key (HPROCI_)

        references JBPM4_HIST_PROCINST (DBID_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HACTI (HACTI_),

        add constraint FK_HDETAIL_HACTI

        foreign key (HACTI_)

        references JBPM4_HIST_ACTINST (DBID_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HTASK (HTASK_),

        add constraint FK_HDETAIL_HTASK

        foreign key (HTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    alter table JBPM4_HIST_DETAIL

        add index FK_HDETAIL_HVAR (HVAR_),

        add constraint FK_HDETAIL_HVAR

        foreign key (HVAR_)

        references JBPM4_HIST_VAR (DBID_);

 

    alter table JBPM4_HIST_TASK

        add index FK_HSUPERT_SUB (SUPERTASK_),

        add constraint FK_HSUPERT_SUB

        foreign key (SUPERTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);

 

    create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);

 

    alter table JBPM4_HIST_VAR

        add index FK_HVAR_HPROCI (HPROCI_),

        add constraint FK_HVAR_HPROCI

        foreign key (HPROCI_)

        references JBPM4_HIST_PROCINST (DBID_);

 

    alter table JBPM4_HIST_VAR

        add index FK_HVAR_HTASK (HTASK_),

        add constraint FK_HVAR_HTASK

        foreign key (HTASK_)

        references JBPM4_HIST_TASK (DBID_);

 

    create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);

 

    alter table JBPM4_ID_GROUP

        add index FK_GROUP_PARENT (PARENT_),

        add constraint FK_GROUP_PARENT

        foreign key (PARENT_)

        references JBPM4_ID_GROUP (DBID_);

 

    create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);

 

    create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);

 

    alter table JBPM4_ID_MEMBERSHIP

        add index FK_MEM_GROUP (GROUP_),

        add constraint FK_MEM_GROUP

        foreign key (GROUP_)

        references JBPM4_ID_GROUP (DBID_);

 

    alter table JBPM4_ID_MEMBERSHIP

        add index FK_MEM_USER (USER_),

        add constraint FK_MEM_USER

        foreign key (USER_)

        references JBPM4_ID_USER (DBID_);

 

    create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);

 

    create index IDX_JOB_CFG on JBPM4_JOB (CFG_);

 

    create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);

 

    create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);

 

    create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);

 

    create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);

 

    alter table JBPM4_JOB

        add index FK_JOB_CFG (CFG_),

        add constraint FK_JOB_CFG

        foreign key (CFG_)

        references JBPM4_LOB (DBID_);

 

    create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);

 

    alter table JBPM4_LOB

        add index FK_LOB_DEPLOYMENT (DEPLOYMENT_),

        add constraint FK_LOB_DEPLOYMENT

        foreign key (DEPLOYMENT_)

        references JBPM4_DEPLOYMENT (DBID_);

 

    create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);

 

    alter table JBPM4_PARTICIPATION

        add index FK_PART_SWIMLANE (SWIMLANE_),

        add constraint FK_PART_SWIMLANE

        foreign key (SWIMLANE_)

        references JBPM4_SWIMLANE (DBID_);

 

    alter table JBPM4_PARTICIPATION

        add index FK_PART_TASK (TASK_),

        add constraint FK_PART_TASK

        foreign key (TASK_)

        references JBPM4_TASK (DBID_);

 

    create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);

 

    alter table JBPM4_SWIMLANE

        add index FK_SWIMLANE_EXEC (EXECUTION_),

        add constraint FK_SWIMLANE_EXEC

        foreign key (EXECUTION_)

        references JBPM4_EXECUTION (DBID_);

 

    create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);

 

    alter table JBPM4_TASK

        add index FK_TASK_SWIML (SWIMLANE_),

        add constraint FK_TASK_SWIML

        foreign key (SWIMLANE_)

        references JBPM4_SWIMLANE (DBID_);

 

    alter table JBPM4_TASK

        add index FK_TASK_SUPERTASK (SUPERTASK_),

        add constraint FK_TASK_SUPERTASK

        foreign key (SUPERTASK_)

        references JBPM4_TASK (DBID_);

 

    create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);

 

    create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);

 

    create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);

 

    create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_LOB (LOB_),

        add constraint FK_VAR_LOB

        foreign key (LOB_)

        references JBPM4_LOB (DBID_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_EXECUTION (EXECUTION_),

        add constraint FK_VAR_EXECUTION

        foreign key (EXECUTION_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_EXESYS (EXESYS_),

        add constraint FK_VAR_EXESYS

        foreign key (EXESYS_)

        references JBPM4_EXECUTION (DBID_);

 

    alter table JBPM4_VARIABLE

        add index FK_VAR_TASK (TASK_),

        add constraint FK_VAR_TASK

        foreign key (TASK_)

        references JBPM4_TASK (DBID_);

 

 


 

 

2.       加入依赖的jar包

Jbpm.jar

 

配置自己的Mysql 库

如在src下或其他源代码目录下,放置

 

Jpbm.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>

 

<jbpm-configuration>

  <import resource="jbpm.default.cfg.xml" />

  <import resource="jbpm.tx.hibernate.cfg.xml" />

  <import resource="jbpm.jpdl.cfg.xml" />

  <import resource="jbpm.identity.cfg.xml" />

</jbpm-configuration>

 


 

Jbpm.hibernate.cfg.xml

 

<?xml version="1.0" encoding="utf-8"?>

 

<!DOCTYPE hibernate-configuration PUBLIC

          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

  <session-factory>

     <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

     <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>

     <property name="hibernate.connection.url">jdbc:mysql://localhost/eoffice?useUnicode=true&amp;characterEncoding=utf-8</property>

     <property name="hibernate.connection.username">root</property>

     <property name="hibernate.connection.password">000</property>

     <property name="hibernate.format_sql">true</property>

     <mapping resource="jbpm.repository.hbm.xml" />

     <mapping resource="jbpm.execution.hbm.xml" />

     <mapping resource="jbpm.history.hbm.xml" />

     <mapping resource="jbpm.task.hbm.xml" />

     <mapping resource="jbpm.identity.hbm.xml" />

  </session-factory>

</hibernate-configuration>

 



 

扩展流程中的角色与用户为自己系统中的用户及角色。

 

AppUser实体需要扩展org.jbpm.api.identity.User接口

AppRole实体需要扩展org.jbpm.api.identity.Group接口

 

实现自己系统中的IdentityService接口

 

如写一个类(UserSession)实现org.jbpm.pvm.internal.identity.spi.IdentitySession这个接口。

 

public class UserSession implements IdentitySession{

      

        //仅需要扩展以下方法即可

 

         //---------------------------------methods above are not need overwrite--------------------------------------------

  

    @Override

    public Group findGroupById(String groupId) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<Group> findGroupsByUser(String arg0) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<Group> findGroupsByUserAndGroupType(String arg0, String arg1) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public User findUserById(String arg0) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<User> findUsers() {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<User> findUsersByGroup(String arg0) {

       // TODO Auto-generated method stub

       return null;

    }

 

    @Override

    public List<User> findUsersById(String... arg0) {

       // TODO Auto-generated method stub

       return null;

   }

}

 


加入用户及组的系统扩展实现配置。

Jbpm.identity.cfg.xml

 

<?xml version="1.0" encoding="UTF-8"?>

 

<jbpm-configuration>

  <transaction-context>

     <object class="com.htsoft.core.jbpm.UserSession"/>

  </transaction-context>

</jbpm-configuration>

 



 

 

配置Jbpm.xml的Spring配置文件

<?xml version="1.0" encoding="UTF-8"?>

 

<beans xmlns="http://www.springframework.org/schema/beans"

    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"

    default-lazy-init="true">

  

    <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">

        <constructor-arg value="jbpm.cfg.xml" />

    </bean>

  

    <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />

    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />

    <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />

    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>

    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>

    <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>

  

    <!--

    <bean id="jbpmTemplate" class="com.bmsoft.jbpm.spring.JbpmTemplate">

       <property name="processEngine" ref="processEngine"/>

       <property name="proDefinitionService" ref="proDefinitionService"/>

       <property name="dataSource" ref="dataSource"/>

    </bean>

     -->

</beans>

 


如下,在此则可以完成在Spring程序中引入Jpbm4的开发应用,后面取可以进行应用流程发布,表单会签等的操作了。

 

分享到:
评论
10 楼 tongliaozhang 2010-06-30  
JBPM4.3 通过什么方法来获得ProcessEngine?
类似于 SpringConfiguration 的buildProcessEngine()方法?
9 楼 wangdgsc 2010-03-02  
你好,我不能问一下,你那个jobexecutor是怎么弄的,我使用spring+hibernate+jbpm4,会自动启动jobexecutor,而每次查询数据表的时候,总会说session is closed(session是spring管理的),有没有办法解决这个问题?
8 楼 yuanlijia1 2010-01-21  
谁在啊?帮个忙!
7 楼 yuanlijia1 2010-01-21  
eclipse+resion  jbpm4.0与项目整合在eclipse下可以编辑运行,单独用resion或tomcat部署会报错。
异常:
[11:40:59.734] javax.servlet.ServletException: org.springframework.beans.factory
.BeanCreationException: Error creating bean with name 'jbpmConfiguration' define
d in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of
bean failed; nested exception is org.springframework.beans.BeanInstantiationExc
eption: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfig
uration]: Constructor threw exception; nested exception is java.lang.ExceptionIn
InitializerError

不知道为什么会这样?
6 楼 lyfvslw 2009-10-27  
好了,自己搞定了,谢谢楼主
5 楼 lyfvslw 2009-10-26  
扩展流程中的角色与用户为自己系统中的用户及角色。

AppUser实体需要扩展org.jbpm.api.identity.User接口

AppRole实体需要扩展org.jbpm.api.identity.Group接口

能不能说说具体的啊?扩展后,任务接口的findGroupTask是不是就不能用了?
谢谢!

4 楼 man1900 2009-09-22  
呵,没有格式化代码。
ProcessEngineFactoryBean这个东西也可以不用,直接用回Jbpm提供的实现,
如我在
<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
   <constructor-arg value="jbpm.cfg.xml" />
   <property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
3 楼 nickevin 2009-09-22  
回答的好

引用
修改以上 <standard-transaction-interceptor />为<spring-transaction-interceptor />
<hibernate-session /><transaction />为<hibernate-session current="true"/>
current="true"这个属性将强使jbpm搜索当前的spring提供的session。


不怎么清楚 差点没有把<transaction />给去掉 就没有成功  帮你格式化一下

<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

	<process-engine-context>
		<command-service>
			<retry-interceptor />
			<environment-interceptor />
			<spring-transaction-interceptor />
		</command-service>
	</process-engine-context>

	<transaction-context>
		<hibernate-session current="true" />
	</transaction-context>

</jbpm-configuration>



另外 把你的文章和 http://yale.iteye.com/blog/462792 就完美了 其中你帮我解决了事务问题 而引用的文章帮我找到了 ProcessEngineFactoryBean 这个类

事务问题 已经拖了我2个月了 今天解决了 酣畅淋漓

谢谢
2 楼 man1900 2009-09-22  
问题提得很好,关于Jbpm4的事务管理问题,可以把所有的操作均封装在JbpmTemplate的Bean里,则它来完成,它则由Spring的事务拦截器进行了拦截管理,因而可以保证事务。

如:

    <tx:annotation-driven transaction-manager="txManager"/>
   
  <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
   <property name="sessionFactory" ref="sessionFactory" />
    </bean>

<aop:config>
<aop:pointcut id="servicePointCut" expression="execution(* com.htsoft.oa.service..*(..))"/>
<aop:pointcut id="servicePointCut2" expression="execution(* com.htsoft.core.service..*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="servicePointCut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="servicePointCut2"/>
</aop:config>

<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true"/>
<tx:method name="is*" read-only="true"/>
<tx:method name="find*" read-only="true"/>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>

而另一种方式可以使用通过改写Jbpm4中的jbpm.tx.hibernate.cfg.xml的配置,主要是修改processEngine 这个bean里的sessionFactory.从而再加上上面这种方式来进行事务的管理。

如:原配置为:
<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

  <process-engine-context>
    <command-service>
      <retry-interceptor />
      <environment-interceptor />
      <standard-transaction-interceptor />
    </command-service>
  </process-engine-context>

  <transaction-context>
    <transaction />
    <hibernate-session />
  </transaction-context>

</jbpm-configuration>

修改以上 <standard-transaction-interceptor />为<spring-transaction-interceptor />
<hibernate-session /><transaction />为<hibernate-session current="true"/>
current="true"这个属性将强使jbpm搜索当前的spring提供的session。

另外,你需要在你的hibernateSessionFactory上配置上Jpbm的hbm.xml文件。如:

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingLocations">
<list>
<value>classpath*:com/htsoft/oa/model/**/*.hbm.xml</value>
<value>classpath:jbpm.repository.hbm.xml</value>
    <value>classpath:jbpm.execution.hbm.xml</value>
    <value>classpath:jbpm.history.hbm.xml</value>
    <value>classpath:jbpm.task.hbm.xml</value>
    <value>classpath:jbpm.identity.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="connection.useUnicode">true</prop>
<prop key="connection.characterEncoding">utf-8</prop>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
<prop key="hibernate.jdbc.fetch_size">20</prop>
<prop key="show_sql">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="net.sf.ehcache.configurationResourceName">conf/ehcache.xml</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
</props>
</property>
</bean>

最后还需要在jbpm.default.cfg.xml中注释以下代码:
<!--
    <hibernate-configuration>
      <cfg resource="jbpm.hibernate.cfg.xml" />    
    </hibernate-configuration>
    <hibernate-session-factory />
-->

这样测试马上可以通过
1 楼 nickevin 2009-09-22  
你的事务如何处理  这是个大问题

相关推荐

    jbpm4 集成 spring 的试用代码

    1. **集成配置**:首先,我们需要在Spring的配置文件中引入jbpm4的相关bean,如`jbpmServiceFactoryBean`,用于创建流程引擎。同时,配置数据源、事务管理器等,确保jbpm4与Spring的事务管理能够协同工作。 2. **...

    jbpm4.4spring.rar_jbpm4_jbpm4.4

    【标题】"jbpm4.4spring.rar_jbpm4_jbpm4.4" 提供的是一个关于JBPM4.4与Spring框架整合的实际应用案例。JBPM(Java Business Process Management)是一款开源的工作流管理系统,它允许开发者设计、执行、管理和监控...

    jbpm+spring配置

    1. **引入依赖**:首先,要在Spring应用中使用jbpm,你需要在项目中引入jbpm的相关库,包括jbpm的jar包和Spring对jbpm的支持库。这通常通过Maven或Gradle的依赖管理来实现。 2. **配置jbpm数据源**:jbpm需要一个...

    jBPM4与Spring整合的2种方式

    1. **引入Spring-JBPM4依赖**:Spring社区提供了Spring-JBPM4模块,可以直接集成到Spring应用中。添加相应的Maven或Gradle依赖。 2. **配置jbpmContext**:创建一个jbpmContext的bean,它会自动配置jBPM4所需的服务...

    提前试用spring 集成 jbpm4

    4. 在Spring的主配置文件中,引入jbpm的配置,使Spring能够管理jbpm4的生命周期。 接着,我们需要设计和部署工作流程。jbpm4提供了图形化的工作流建模工具,开发者可以通过拖拽节点来创建流程图。流程定义通常保存...

    Jbpm4.4 整合Spring Hibernate4

    在这个版本中,Jbpm与Spring框架和Hibernate ORM工具进行了整合,实现了更加灵活和高效的企业级应用开发。 **1. Jbpm简介** Jbpm4.4是Jbpm系列的一个版本,它主要负责处理业务流程的建模、执行、管理和监控。它支持...

    jbpm4整合struts2+spring2.5+hibernate3.3

    【jbpm4整合struts2+spring2.5+hibernate3.3】的集成是企业级应用开发中常见的技术栈组合,旨在利用各框架的优势实现高效、灵活的业务流程管理。jbpm4是一个开源的工作流管理系统,用于定义、执行和管理业务流程。...

    jbpm4.3与spring整合

    在企业级应用开发中,流程管理引擎JBPM(JBoss Business Process Management)与Spring框架的结合使用是常见的一种技术方案。JBPM是一个灵活、强大的业务流程管理工具,而Spring框架则以其优秀的依赖注入(DI)和...

    spring4.1.1+jbpm6.4.0+maven

    在项目中,这三者结合可能意味着开发者可以利用Spring 4.1.1的灵活架构来构建应用程序,通过JBPM 6.4.0设计和管理复杂的业务流程,而Maven则确保整个开发过程的一致性和可重复性。这种集成使得开发人员能够快速地...

    spring2_struts2_jbpm3.2.rar_jbpm struts2_jbpm-demo_jbpm3 spring_

    1. 配置Spring:引入JBPM的库,并在Spring配置文件中声明流程管理相关的bean,如ProcessEngine、RepositoryService等。 2. 集成JBPM:通过Spring的JdbcTemplate或JPA实现数据库连接,配置jbpm-datasource.xml文件,...

    spring3.2+jBPM6整合实例

    4. **部署流程定义**:在Spring应用启动时,使用`DeploymentService`部署流程定义,这会将BPMN 2.0 XML文件加载到流程引擎中。 5. **启动流程实例**:当需要执行某个流程时,通过`RuntimeService`的`...

    Spring+hibernate4+SpringMVC+Jbpm4.4

    在本项目中,Jbpm 4.4 被整合到Spring框架中,用于实现流程驱动的应用,如审批流程、订单处理等。 **MySQL 数据库** MySQL 是一种流行的关系型数据库管理系统,广泛应用于Web应用。在本项目中,MySQL被选为后端...

    jbpm4.1和jbpm5开发手册

    通过阅读《jbPM4.1中文用户手册》和《jBPM5_用户手册-中文版》,开发者不仅可以掌握jbPM的基础知识,还能深入理解业务流程管理的原理和实践,从而在实际项目中高效地应用jbPM来提升业务流程的自动化水平和管理效率。

    Jbpm4.4+hibernate3.5.4+spring3.0.4+struts2.1.8整合

    【JBPM4.4+Hibernate3.5.4+Spring3.0.4+Struts2.1.8整合】的整个过程涉及到多个关键组件的集成,这些组件都是Java企业级开发中的重要部分。首先,JBPM(Business Process Management)是一个开源的工作流引擎,它...

    Spring Jbpm流程整合1

    整合JBPM到Spring应用中,首先要在Spring的配置文件(如app-jbpm.xml)中进行配置,将JBPM的相关组件和服务声明并初始化。这可能涉及到SessionFactory、TransactionManager等的配置,确保它们与Spring的其他服务协同...

    jbpm4整合ssh框架

    - 首先,引入jbpm4、Struts、Spring和Hibernate的依赖库。 - 然后,配置Spring,创建jbpm4的数据源、SessionFactory和ProcessEngine,以及流程定义的部署服务。 - 接着,编写Struts的Action类,定义业务操作,并...

    Struts+Hibernate+spring+jpa+lucene+jbpm+compass配置文件

    Struts、Hibernate、Spring、JPA、Lucene、JBPM和Compass是Java开发中常用的一系列技术,它们各自在不同的领域发挥着重要作用。这里我们将深入探讨这些技术以及如何将它们整合在一起进行配置。 1. **Struts**:...

    jbpm4与ssh整合

    1. **配置Spring**:首先,我们需要在Spring配置文件中引入jbpm4的相关bean,如`jbpmContext`、`jbpmTaskService`等,这些bean会负责与jbpm4服务器的交互。 2. **集成Hibernate**:jbpm4本身支持Hibernate作为其...

    Spring整合JBPM、日志、数据库、ehcache的配置文件

    在这个场景中,我们关注的是如何将Spring框架与JBPM(Business Process Management,业务流程管理)、日志记录、数据库以及ehcache缓存系统进行整合。这些组件在实际应用开发中扮演着至关重要的角色。下面将详细阐述...

Global site tag (gtag.js) - Google Analytics