分类:
2007-07-02 13:57:00
周末在家下了jbpm-3.0.2,完全重新配置,在单位用的一直是jbpm-starters-kit-3.0.2,可能已经被改乱了,屡试不中,该注意的地方全注意了,居然成了,一扫几日来的阴霾。参考了
jBPM3.1 +Oracle10g+Tomcat-5.0.30安装实践
http://www.blogjava.net/znjqolf/archive/2005/12/19/24654.html JBPM- 整合Jbpm,tomcat,mysql
完全按照他们的步骤也没成功,因此总结自己的配置方法如下(建议所有配置文件修改完毕再运行ant,因为在jbpm的build文件中依赖关系设置并不完全准确,会造成后改的不生效):
环境:
jdk1.5.0_05
jakarta-tomcat-5.5.9
apache-ant-1.6.5(1.6.0会报错)
mysql-5.0.16-win32
jbpm-3.0.2
一、JBPM_HOME即为解开的jbpm-3.0.2.zip文件
%JBPM_HOME%\lib下,建mysql目录,将mysql的jdbc驱动拷入;
在mysql中建数据库 CREATE DATABASE jbpm;
二、为ant创建jbpm相关数据库修改相关配置文件
1、%JBPM_HOME%\src\resources目录下,将“hsqldb”目录改名为“mysql”,并修改create.db.hibernate.properties文件,形如:
# these properties are used by the build script to create
# a hypersonic database in the build/db directory that contains
# the jbpm tables and a process deployed in there
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/jbpm
hibernate.connection.username=root
hibernate.connection.password=
hibernate.c3p0.min_size=2
hibernate.c3p0.max_size=3
hibernate.show_sql=true
2、修改%JBPM_HOME%\build.deploy.xml文件中“target”为“create.db” 的內容,删除“db.start”,“db.stop”,将所有的“hsqldb”替换为“mysql”
形如:
三、为ant创建jbpm.war包修改相关配置文件
1、修改%JBPM_HOME%\src\config.files\hibernate.cfg.xml文件中数据库连接配置部分,形如:
……
……
2、修改%JBPM_HOME%\src\resources\jbpm.sar\jbpm.properties,形如:
jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl
jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance
# uncomment the next line if JbpmSessionFactory.getInstance()
# should lookup the singleton instance from JNDI instead of creating
# a default one.
#
# jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory
# uncomment the next line to use the file system instead of the database for
# storing files related to a process definition
#
# jbpm.files.dir=c:/jbpm.data
# resource path to a properties file that will overwrite all the hibernate
# properties. For database specific builds in db project there is a different
# hibernate.properties file on the classpath for each database. You could change
# the default database for any testing runs by uncommenting the next line and
# adding a hibernate.properties file in the basedir.
#
jbpm.hibernate.cfg.xml=jbpm.hibernate.cfg.xml
# jbpm.hibernate.properties=jbpm.hibernate.properties
3、修改%JBPM_HOME%\src\resources\jbpm.sar\jbpm.hibernate.properties,只用hibernate.cfg.xml来配置hibernate,因此全部注释掉,形如:
# hibernate.dialect=org.hibernate.dialect.HSQLDialect
# hibernate.connection.datasource=java:/DefaultDS
# hibernate.show_sql=true
4、修改%JBPM_HOME%\build.deploy.xml文件,“target”为“build.webapp”的內容,原文件相关的jar包未包含全,因此补全,形如:
四、执行Ant
1、创建并初始化jbpm例子所需的table
ant create.db -buildfile build.deploy.xml
2、生成jbpm.war
ant build.webapp -buildfile build.deploy.xml
五、tomcat拥抱jbpm
将%JBPM_HOME%\build\jbpm.war文件复制到Tomcat的webapp目录下,启动Tomcat自动部署jbpm,访问,出现登录页面,配置成功。
按此法部署成功