0 Replies Latest reply on Dec 22, 2004 6:53 AM by amit dixit

    Full config of jbpm with OC4J/oracle9i

    amit dixit Newbie

      i have succesfully integrated jbpm with oc4j n oracle 8i here is the step by step methods for it
      ************************************************************

      Summary:

      This document describes procedures of downloading, deploying, and running jbpm2.0 on Oracle9I database and application server (OC4J). This material is based on docs in www.jbpm.org & discussion on www.jbpm.org/support.html & http://sourceforge.net/forum/forum.php?forum_id=240085. All exercises are performed in Windows XP.

      Requirements:

      Standard Java SDK and JDBC driver (classes12.jar) and Apache Ant., Standalone OC4J server or jdeveloper 10g .

      Download jbpm and unzip it to local directory

      Download jbpm-2.0-beta3.zip from http://www.jbpm.org and unzip jbpm (jbpm-2.0-beta3.zip) to local m/c. The extracted directory is jbpm-2.0 which is jbpm.home.

      After , we should have a directory structure under jbpm-2.0 like this:

      +core
      +doc
      +ejb
      +example
      +lib
      +web
      build.properties
      build.xml
      common.build.xml
      ?

      After modification build.properties should look like:
      Here we assume that jbpm and ant are deployed in E drive of the system
      //-------------------------------------------------------------------------------------------
      # jbpm main build properties
      #
      # you can overwrite properties in this file by adding a file called build.local.properties in
      # this directory and override the properties you want to customize. this way you don't have to
      # change this file since this one is managed by cvs.

      #########
      # homes #
      #########
      jbpm.home=E:/jbpm-2.0
      ant.home=E:/ant
      jboss.home=E:/jboss4 # jboss is used for taking some library files

      ############
      # jbpm.pde #
      ############
      # is only used when you want to create a separate Process
      # Development Environment. That is a directory structure
      # for developing processes, outside of the jbpm2 directory
      # structure. See also the ant target 'create.pde'
      jbpm.pde=E:/jbpm.pde
      Note jboss.home is just a dummy directory because we use OC4J .


      Deploy your application using ant build tool


      In this step ant deploy, which compiles and deploys the web application. There are many class-not-found compiling errors. Make sure those missing library files (.jar, etc) are included in the %classpath%. For instance %classpath% should contain ?\jbpm-2.0-beta3\lib\hibernate and ..\lib\hibernate\.jar, etc.

      TRACE OF THE PROCESS

      E:\jbpm-2.0\web>ant deploy
      Buildfile: build.xml

      build.core:

      compile:

      build:

      compile:

      build.process.archives:

      build:

      deploy:

      BUILD SUCCESSFUL

      Generate jbpm.war from ant tool

      Under {$jbpm.home}\web>ant deploy.process.archives. The purpose is to generate jbpm.war given the processdefinition.xml ? sample pay raise process. Here are some critical steps.

      Jbpm.properties file in {$jbpm.home}\web\src\jbpm.war\WEB-INF\classes should be modified like:

      //------------------------------------------------------------------------------------
      # In this file, you can overwrite the default jbpm configuration properties.
      # See the javadocs of org.jbpm.JbpmConfiguration for more information about
      # configuring jBpm.
      hibernate.query.substitutions=true 1, false 0
      hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect
      hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver # thin driver for oracle
      hibernate.connection.url=jdbc:oracle:thin:@server1:1521:cpms
      hibernate.connection.username=arno
      hibernate.connection.password=arno
      jbpm.file.mgr=filesystem
      jbpm.file.mgr.directory=E:/jbpmDB
      jbpm.create.tables.log=true
      show_sql=true
      //------------------------------------------------------------------------------------

      Specific value settings should follow your own environment. Prior to this deployment, make sure you be able to connect to the oracle db using the url, username, and password. This is very important. Of course you need to resolve any compiling errors by including proper library files in the %classpath%. In this process, database tables (schema) should be generated in the database connection.

      Edit schema.generation.properties in E:\jbpm-2.0\core

      ### SCHEMA GENERATION PROPERTIES ###

      hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect
      hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
      hibernate.connection.url=jdbc:oracle:thin:@server1:1521:cpms
      hibernate.connection.username=arno
      hibernate.connection.password=arno
      jbpm.create.tables.log=true

      Generate sql script from ant

      TRACE OF THE PROCESS

      E:\jbpm-2.0\core>ant generate.ddl
      Buildfile: build.xml

      compile:

      build:

      generate.ddl:
      [schemaexport] log4j:WARN No appenders could be found for logger (net.sf.hiberna
      te.cfg.Environment).
      [schemaexport] log4j:WARN Please initialize the log4j system properly.
      [echo] the schema is generated in target/sql/create-jbpm-database.sql

      BUILD SUCCESSFUL
      Total time: 4 seconds

      To avoid log4j warning put log4j.properties in %classpath% having following contents

      #log4j.properties
      log4j.rootCategory=INFO, A1
      log4j.appender.A1=org.apache.log4j.ConsoleAppender
      log4j.appender.A1.layout= org.apache.log4j.PatternLayout
      log4j.appender.A1.layout.ConversionPattern=%-5p - %m%n

      Now finally deploy the archive

      TRACE OF THE PROCESS

      E:\jbpm-2.0\web>ant deploy.process.archives
      Buildfile: build.xml

      build.core:

      compile:

      build:

      compile:

      build.process.archives:

      declare.jbpm.tasks:

      deploy.process.archives:
      [deploypar] 10:38:19,594 debug [JbpmConfiguration] jBpm configuration:
      [deploypar] 10:38:19,594 debug [JbpmConfiguration] [//------------------------
      ------------------------------------------------------------]
      [deploypar] 10:38:19,594 debug [JbpmConfiguration] [hibernate.connection.drive
      r_class] oracle.jdbc.driver.OracleDriver
      [deploypar] 10:38:19,594 debug [JbpmConfiguration] [hibernate.connection.passw
      ord] arno
      [deploypar] 10:38:19,594 debug [JbpmConfiguration] [hibernate.connection.url]
      jdbc:oracle:thin:@server1:1521:cpms
      [deploypar] 10:38:19,594 debug [JbpmConfiguration] [hibernate.connection.usern
      ame] arno
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [hibernate.dialect] net.sf.
      hibernate.dialect.Oracle9Dialect
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [hibernate.query.substituti
      ons] true 1, false 0
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [jbpm.apply.transactions] y
      es
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [jbpm.create.tables] only-i
      f-not-present
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [jbpm.create.tables.log] tr
      ue
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [jbpm.create.tables.query]
      SELECT ID FROM JBPM_DEFINITION WHERE ID = 1
      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [jbpm.execute.actions] true

      [deploypar] 10:38:19,610 debug [JbpmConfiguration] [jbpm.file.mgr] filesystem
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.file.mgr.directory] E
      :/jbpmDB
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.id.generator] default

      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.id.generator.block.si
      ze] 100
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.id.generator.configur
      ation] same
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.id.generator.node.id]
      0
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.log.default] error
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.log.package.org.jbpm]
      debug
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.log.stdout] on
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.persistence.session.f
      actory] hibernate
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.scheduler.wait.period
      ] 5000
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.service.factory] defa
      ult
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [jbpm.validate.xml] true
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] [show_sql] true
      [deploypar] 10:38:19,625 debug [JbpmConfiguration] for key 'jbpm.file.mgr', an o
      bject of type 'org.jbpm.persistence.filemgr.FileSystemFileMgr' was instantiated
      [deploypar] 10:38:19,641 debug [HibernateSessionFactory] creating the hibernate
      session factory
      [deploypar] 10:38:23,204 debug [HibernateSessionFactory] created the hibernate s
      ession factory
      [deploypar] 10:38:23,204 debug [JbpmConfiguration] for key 'jbpm.persistence.ses
      sion.factory', an object of type 'org.jbpm.persistence.hibernate.HibernateSessio
      nFactory' was instantiated
      [deploypar] 10:38:23,313 debug [SequenceBlockIdGenerator] created the hibernate
      session factory for the id generator
      [deploypar] 10:38:23,313 debug [JbpmConfiguration] for key 'jbpm.id.generator',
      an object of type 'org.jbpm.persistence.hibernate.SequenceBlockIdGenerator' was
      instantiated
      [deploypar] 10:38:23,344 debug [JbpmConfiguration] for key 'jbpm.service.factory
      ', an object of type 'org.jbpm.impl.DefaultServiceFactory' was instantiated
      [deploypar] using configuration file: E:\jbpm-2.0\web\src\jbpm.war\WEB-INF\class
      es\jbpm.properties
      [deploypar] using configuration: {hibernate.connection.password=arno, jbpm.valid
      ate.xml=true, hibernate.query.substitutions=true 1, false 0, jbpm.id.generator.n
      ode.id=0, jbpm.apply.transactions=yes, jbpm.create.tables=only-if-not-present, s
      how_sql=true, jbpm.id.generator.block.size=100, jbpm.log.package.org.jbpm=debug,
      jbpm.log.default=error, jbpm.file.mgr=filesystem, jbpm.id.generator.configurati
      on=same, //---------------------------------------------------------------------
      ---------------=, jbpm.persistence.session.factory=hibernate, jbpm.create.tables
      .query=SELECT ID FROM JBPM_DEFINITION WHERE ID = 1, hibernate.connection.usernam
      e=arno, hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver, jbpm.
      log.stdout=on, jbpm.service.factory=default, jbpm.file.mgr.directory=E:/jbpmDB,
      jbpm.execute.actions=true, jbpm.id.generator=default, jbpm.create.tables.log=tru
      e, hibernate.dialect=net.sf.hibernate.dialect.Oracle9Dialect, hibernate.connecti
      on.url=jdbc:oracle:thin:@server1:1521:cpms, jbpm.scheduler.wait.period=5000}
      [deploypar] deploying process archive E:\jbpm-2.0\web\target\payraiseprocess.par
      ...
      [deploypar] 10:38:23,407 info [DefinitionServiceImpl] deploying process archive
      ...
      [deploypar] 10:38:23,407 debug [HibernateSession] beginning a jbpm transaction
      [deploypar] 10:38:23,563 debug [SequenceBlockIdGenerator] getting a new block of
      ids: 0, -1
      [deploypar] 10:38:23,563 debug [SequenceBlockIdGenerator] beginning a jbpm id-se
      quence transaction
      [deploypar] 10:38:23,563 debug [SequenceBlockIdGenerator] check the sequence blo
      ck in the db for nodeId: 0
      [deploypar] 10:38:23,625 debug [SequenceBlockIdGenerator] no sequence block foun
      d for 0, creating a new one
      [deploypar] 10:38:23,625 debug [SequenceBlockIdGenerator] fetched sequence block
      from db: SequenceBlock[0|1]
      [deploypar] 10:38:23,625 debug [SequenceBlockIdGenerator] first id of overall bl
      ock is: 1
      [deploypar] 10:38:23,688 debug [SequenceBlockIdGenerator] committing a jbpm id-s
      equence transaction
      [deploypar] 10:38:23,703 debug [SequenceBlockIdGenerator] updated sequence block
      SequenceBlock[0|6553601] was commited
      [deploypar] 10:38:23,703 debug [SequenceBlockIdGenerator] got a new block of ids
      for this node: 1, 100
      [deploypar] 10:38:23,750 debug [HibernateSession] committing a jbpm transaction
      [deploypar] 10:38:24,110 debug [DefinitionServiceImpl] deployed process pay rais
      e process and assigned version number 1
      [deploypar] 10:38:24,110 debug [HibernateSession] closing a jbpm persistence con
      nection

      BUILD SUCCESSFUL
      Total time: 7 seconds

      Open jdeveloper and see the tables in specified schema

      After this jdeveloper will show 16 tables starting from JBPM_<some name> All these classes are used by jbpm for maintaining the workflow

      Open jbpm.war(pay raise example) in jdeveloper


      Now open the project file named jbpm.war situated at E:\jbpm-2.0\web\target that project can be opened as a project from an existing war file option provided by jdeveloper
      Now compile and run your application using run manager of jdeveloper
      ***********************************************************
      best of luck
      Amit Dixit