`

jBPM5.4-05:使用SqlServer2008数据库(转)

    博客分类:
  • JBPM
 
阅读更多

未找到原文出处,在安装过程中有些步骤不同,要参考上一篇:jBPM5.4-04:使用MySql数据库

 

 

I have been using JBPM5.3 for some months and then I switch to JBPM5.4.

After I download JBPM5.4.Final full installer, I thought the DB Set up will be exactly the same with JBPM5.3 full installerhttps://community.jboss.org/wiki/SetUpJBPM53ToUseMSSQLServer2008

But I realized that some things has changed and at the time when I write this, the guide for changing Database in JBPM5.4 full installer is still outdatedhttp://docs.jboss.org/jbpm/v5.4/userguide/ch.installer.html#d0e609

 

 

A. What I Am Going To Do

     1. I will change the Database setting of jbpm5.4 final full installer and point it to use MS SQL Server 2008

     2. The Database driver used is jtds-1.2.4

     3. Although it is possible to have separate database for Task and Process data, in this setup I will use only one Database for all the Task database tables and all the Process database tables.

     4. I do this set up using Windows XP 64 Bit

     5. apache ant version used is Apache Ant 1.8.4

     6. jdk used is jdk 1.6 (set in Windows Environment variable as JAVA_HOME)

     7. I use 7-zip to help me modify files inside a .war file

 

B. The Setup Steps

1. JBPM5.4 final full installer comes with almost every needed component, except eclipse (optional). But I want the eclipse, so I download eclipse-java-helios-SR2-win32-x86_64.zip and put it into

     jbpm-installer\lib folder

 

2. Because my OS is 64 bit version, I have to do a modification to the build.xml file found in jbpm-installer folder. So I changed this part

 

<!-- Download Eclipse -->

  <condition property="download.type" value="win32">

    <os family="windows" />

  </condition>

 

to

 

<!-- Download Eclipse -->

  <condition property="download.type" value="win32-x86_64">

    <os family="windows" />

  </condition>

 

3. Now its time to set up the Hibernate settings, mostly we will make changes to the hibernate dialect, lets open jbpm-installer\db folder.

 

4. I am not sure how each file is used here in jbpm5.4 since the official guide still reflect jbpm5.3 files, so here is what I do, I start with opening jbpm-installer\db\jbpm-persistence-JPA1.xml

I changed:

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>

      <property name="hibernate.max_fetch_depth" value="3"/>

 

 

to

 

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

      <property name="hibernate.max_fetch_depth" value="3"/>

 

 

5. Then I open jbpm-installer\db\jbpm-persistence-JPA2.xml

I changed:

 

 <properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

      <property name="hibernate.max_fetch_depth" value="3" />

 

 

to

 

 <properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />

      <property name="hibernate.max_fetch_depth" value="3" />

 

 

6. Lets continue, and open jbpm-installer\db\task-persistence-JPA1.xml

I changed:

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>

      <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>

      <property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/runtime/task" />

      <property name="hibernate.connection.username" value="sa"/>

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

 

 

to

 

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

      <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>

      <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://DBName:1433/MyJBPMDB" />

      <property name="hibernate.connection.username" value="myuser"/>

      <property name="hibernate.connection.password" value="mypassword"/>

 

 

7. Open jbpm-installer\db\task-persistence-JPA2.xml

I changed:

 

 <properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>         

      <property name="hibernate.max_fetch_depth" value="3"/>

 

 

to

 

 <properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>         

      <property name="hibernate.max_fetch_depth" value="3"/>

 

 

8. Lets navigate to other file in other folder, lets open jbpm-installer\task-service\resources\META-INF\persistence.xml

I changed:

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>

      <property name="hibernate.connection.driver_class" value="org.h2.Driver"/>

      <property name="hibernate.connection.url" value="jdbc:h2:tcp://localhost/runtime/task" />

      <property name="hibernate.connection.username" value="sa"/>

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

 

to

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

      <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>

      <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://DBName:1433/MyJBPMDB" />

      <property name="hibernate.connection.username" value="myuser"/>

      <property name="hibernate.connection.password" value="mypassword"/>

 

9. Ok, lets dig into .war files in the lib folder, (I use 7-zip to help me modify files inside .war files), lets open jbpm-installer\lib folder

 

10. Open jbpm-installer\lib\jbpm-gwt-console-server-5.4.0.Final-EE6.war\WEB-INF\classes\META-INF\persistence.xml

I changed:

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />

      <property name="hibernate.max_fetch_depth" value="3" />

 

 

to

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" />

      <property name="hibernate.max_fetch_depth" value="3" />

 

 

11. Next, Open jbpm-installer\lib\jbpm-human-task-war-5.4.0.Final-EE6.war\WEB-INF\classes\META-INF\persistence.xml

I changed:

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>         

      <property name="hibernate.max_fetch_depth" value="3"/>

 

to

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>         

      <property name="hibernate.max_fetch_depth" value="3"/>

 

 

12. Allright, seems like we are done changing dialects, lets provide our jtds jar. put jtds-1.2.4.jar into jbpm-installer\db\driver folder

 

13. next, we need to provide an xml file that will be used by jboss AS to recognize our jtds later, so Create a file called sqlserver_module.xml and put it in jbpm-installer\db folder

The file content is:

 

<module xmlns="urn:jboss:module:1.0" name="net.sourceforge.jtds">

   <resources>

     <resource-root path="jtds-1.2.4.jar"/>

   </resources>

 

   <dependencies>

      <module name="javax.api"/>

      <module name="javax.transaction.api"/>

    </dependencies>

</module>

 

 

14. Wondered how the ant build will recognize our sqlserver_module.xml later? Happens to me too at first, lets open jbpm-installer\build.properties file

Look at this section:

 

# data base related properties

db.driver.jar=${install.home}/db/driver/${db.driver.jar.name}

db.driver.module.dir=${jboss.home}/modules/${db.driver.module.prefix}/main/

# default is H2

db.name=h2

db.driver.jar.name=${db.name}.jar

db.driver.download.url=http://repo1.maven.org/maven2/com/h2database/h2/${H2.version}/h2-${H2.version}.jar

#other options are mysql

#  db.name=mysql

#  db.driver.module.prefix=com/mysql

#  db.driver.jar.name=${db.name}-connector-java.jar

#  db.driver.download.url=https://repository.jboss.org/nexus/service/local/repositories/central/content/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar

#postresql

#  db.name=postresql

#  db.driver.module.prefix=org/postgresql

#  db.driver.jar.name=${db.name}-jdbc.jar

#  db.driver.download.url=https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar

 

 

lets comment out the h2 setting and make our own sqlserver setting like this:

 

# data base related properties

db.driver.jar=${install.home}/db/driver/${db.driver.jar.name}

db.driver.module.dir=${jboss.home}/modules/${db.driver.module.prefix}/main/

# default is H2

#db.name=h2

#db.driver.jar.name=${db.name}.jar

#db.driver.download.url=http://repo1.maven.org/maven2/com/h2database/h2/${H2.version}/h2-${H2.version}.jar

#other options are mysql

#  db.name=mysql

#  db.driver.module.prefix=com/mysql

#  db.driver.jar.name=${db.name}-connector-java.jar

#  db.driver.download.url=https://repository.jboss.org/nexus/service/local/repositories/central/content/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.jar

#postresql

#  db.name=postresql

#  db.driver.module.prefix=org/postgresql

#  db.driver.jar.name=${db.name}-jdbc.jar

#  db.driver.download.url=https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/postgresql/postgresql/9.1-902.jdbc4/postgresql-9.1-902.jdbc4.jar

#sqlserver

db.name=sqlserver

db.driver.module.prefix=net/sourceforge/jtds

db.driver.jar.name=jtds-1.2.4.jar

 

 

because or db.name is sqlserver, our sqlserver_module.xml will be recognized by the ant build later on.

If you really want to know the reason, open jbpm-installer\build.xml and look at this section

 

    <copy file="db/${db.name}_module.xml" tofile="${db.driver.module.dir}/module.xml" />

 

 

15. ok, now lets deal with the jboss AS 7 standalone setting, open jbpm-installer\standalone.xml

we need to do two things here, modify data source and make jboss as recognize our jtds driver, so change this section:

 

<datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" use-java-context="true" use-ccm="true">

                    <connection-url>jdbc:h2:~/jbpm</connection-url>

                    <driver>h2</driver>

                    <pool>

                        <min-pool-size>1</min-pool-size>

                        <max-pool-size>4</max-pool-size>

                        <prefill>false</prefill>

                        <use-strict-min>false</use-strict-min>

                        <flush-strategy>FailingConnectionOnly</flush-strategy>

                    </pool>

                    <security>

                        <user-name>sa</user-name>

                    </security>

                    <validation>

                        <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

                        <validate-on-match>false</validate-on-match>

                        <background-validation>false</background-validation>

                    </validation>

                </datasource>

                <drivers>

                    <driver name="h2" module="com.h2database.h2">

                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                    </driver>

                </drivers>

 

 

to

 

               <datasource jndi-name="java:jboss/datasources/jbpmDS" pool-name="H2DS" enabled="true" jta="true" use-java-context="true" use-ccm="true">

                    <connection-url>jdbc:jtds:sqlserver://DBName:1433/MyJBPMDB</connection-url>

                    <driver>JTDS</driver>

                    <pool>

                        <min-pool-size>1</min-pool-size>

                        <max-pool-size>4</max-pool-size>

                        <prefill>false</prefill>

                        <use-strict-min>false</use-strict-min>

                        <flush-strategy>FailingConnectionOnly</flush-strategy>

                    </pool>

                    <security>

                       <user-name>myuser</user-name>

                       <password>mypassword</password>

                    </security>

                    <validation>

                       <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>

                       <validate-on-match>false</validate-on-match>

                       <background-validation>false</background-validation>

                    </validation>

                </datasource>

                <drivers>

                   <driver name="JTDS" module="net.sourceforge.jtds">

                            <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class> 

                    </driver>

                                         <driver name="h2" module="com.h2database.h2">

                                                 <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                                        </driver>

                </drivers>

 

16. Phew, quite a lot files that we have configured. at this point you may want to copy and backup the whole jbpm-installer folder, just in case you missed some configuration and caused error in the installation process later, who knows, things like that can happen, so just to be safe...

 

C. Lets Install it

1. use our windows cmd and go to jbpm-installer folder.

 

2. run "ant install.demo"

 

3. in my case, this happen, so after ant install.demo finished successfully, I need to go to

jbpm-installer\jboss-as-7.1.1.Final\standalone\deployments\jbpm-human-task-war.war\WEB-INF\classes\META-INF\persistence.xml

and modify it from

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>         

      <property name="hibernate.max_fetch_depth" value="3"/>

     <property name="hibernate.hbm2ddl.auto" value="create" />

 

to

 

<properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>         

      <property name="hibernate.max_fetch_depth" value="3"/>

      <property name="hibernate.hbm2ddl.auto" value="update" />

 

 

4. run "ant install.demo.db" to install our db files

 

5. run "ant start.human.task" to let it create the task tables in the database

 

6. stop that cmd (hint: ctrl+c and say Y)

 

5. run "ant start.jboss" to start the JBOSS AS server

 

6. Look at your database, and verify if dbo.Task table is still there.

 

7. Enjoy your JBPM5.4 with MS SQL Server 2008

 

分享到:
评论

相关推荐

    JBPM5.4 SSH 完整项目整合案例

    jbpm5.sql文件是JBPM5.4所需的数据库脚本,包含了初始化数据库表结构和数据。这一步骤至关重要,因为JBPM的工作流定义和执行状态都会存储在数据库中。安装项目前,需要将这些SQL语句执行到你的数据库服务器上,创建...

    JBPM5.4例子程序

    **JBPM5.4详解** JBPM,全称Java Business Process Management,是一个开源的工作流管理系统,专注于业务流程的建模、执行和监控。JBPM5.4是该系统的某一版本,它提供了强大的流程定义和执行能力,适用于企业级应用...

    JBPM5.4 工作流例子

    JBPM5.4使用Hibernate ORM进行数据持久化,确保流程实例和相关数据能够在数据库中保存。同时,系统记录了完整的流程执行历史,方便审计和分析。 5. **集成能力**: JBPM5.4可以轻松集成到Java EE或Spring应用中,...

    ssh整合jbpm5.4

    SSH整合JBPM5.4是将Struts2、Spring3.1、Hibernate4.1这三大主流Java EE框架与业务流程管理(Business Process Management,简称BPM)工具JBPM5.4集成的过程。这个整合旨在提供一个高效、灵活且可扩展的企业级应用...

    第二部分、安装和配置JBPM5.4及Eclipse流程插件安装.rar

    基于java及JBPM5.4流程引擎技术开发.鉴于JBPM5.4版本较新,而目前网上基本上没有对应的简单实例,更不要说负责案例及项目设计。 本课程是在国内没有任何中文文档的情况下,完全靠翻译国外的英文文档并结合项目应用...

    ssh+jbpm5.4 (2)

    Hibernate作为ORM(对象关系映射)工具,简化了数据库操作,使开发者可以使用Java对象来操作数据库,而不是SQL语句。 jbpm5.4是JBoss公司提供的一个开源BPM平台,它支持业务流程建模、执行、监控和优化。jbpm5.4...

    jbpm5.4 spring mvc 集成

    jbpm5.4与Spring MVC的集成是企业级应用开发中的常见组合,它结合了jbpm(业务流程管理)的强大功能和Spring MVC的灵活控制层架构。以下将详细阐述这一集成涉及的关键知识点: 1. **jbpm5.4**:jbpm是一个开源的...

    jbpm-jpdl-3.2.3.zip

    为了使用jbpm-jpdl-3.2.3,你需要按照文档中的步骤配置环境,如添加必要的依赖,然后可以通过创建JPDL文件来定义你的业务流程,并使用jbpm提供的API或者工具启动和管理这些流程。这将帮助你实现企业的业务自动化,...

    JBPM5.4案例与用户指南

    最近初学JBPM,费了很大的劲,因为网上的资料要么是代码,要么是文档,看了两天没有头绪,后来静了下来,仔细看代码和文档(通过代码学习文档,通过文档学习代码),再加上前两天知识的积蓄,终于对JBPM5.4,以及Spring+...

    jbpm5.4_Final_Api.CHM

    jbpm5.4_Final_Api.CHM

    jbpm教程 第二部分、(安装和配置JBPM5.4及Eclipse流程插件安装)

    配置jbpm-persistence.xml文件以连接到你的数据库,并创建所需的表。 4. **服务启动**:运行JBPM的服务器组件,通常是Kie Server,它可以部署和执行流程定义。启动脚本位于bin目录下,根据操作系统执行对应的start....

    jbpm-jpdl-3.2.3(server部分).rar

    这个是jbpm-jpdl-3.2.3.zip的server部分,有60多兆, 只要将"jbpm-jpdl-3.2.3(没有server部分).rar"和这个合在一起就是整个的jbpm-jpdl-3.2.3.zip "jbpm-jpdl-3.2.3(没有server部分).rar"在我的另外一个上传资源里面

    JBPM5.4工作流 Eclipse流程插件安装

    在中文环境中,关于JBPM5.4的资料相对较少,因此,这套教程将深入探讨如何在国内没有中文文档支持的情况下,通过翻译英文文档和实际项目应用来掌握JBPM5.4的使用,确保开发者能够顺利地进行工作流开发。 **1. 安装...

    JBPM5.4帮助文档

    jBPM is a flexible Business Process Management (BPM) Suite. It's light-weight, fully open-source (distributed under Apache license) and written in Java. It allows you to model, execute and monitor ...

    JBPM5.4及Eclipse流程插件安装

    3. **持久化支持**:JBPM5.4使用JPA(Java Persistence API)进行数据持久化,可以与多种数据库无缝集成。 4. **规则引擎**:结合Drools规则引擎,使得流程中的决策逻辑可以通过规则文件进行管理。 5. **任务服务*...

    第四部分、SSH2结合JBPM5.4

    SSH2结合JBPM5.4是企业级应用开发中的一项关键技术组合,主要涉及Spring、Struts2和Hibernate这三个核心框架与Business Process Management System (BPMS)的集成,特别是使用jbpm5.4版本。SSH2提供了强大的后端服务...

    jBPM5.4 API

    CSDN首发jBPM5.4 API文档,带索引

    jbpm-5.4.0.Final

    例如,你可以利用jbpm-human-task-core来设计和实现涉及人员交互的任务流程,通过jbpm-bpmn2解析和执行BPMN 2.0流程图,借助jbpm-persistence-jpa将流程实例持久化到数据库,同时使用jbpm-bam监控流程的运行情况。...

Global site tag (gtag.js) - Google Analytics