Thursday, 24 December 2015

Setting up DROOLS workbench 6.2 on Weblogc 12c

Steps:

  1. Install Weblogic 12c version 12.1.3.0. JDK 1.8. Set up DROOLS groups.
  2. Set up a Git local respository
  3. Modify the workbench war archive
  4. Create a datasource
  5. Maven repository
  6. JVM options

1.Install Weblogic 12c version 12.1.3.0. Set up DROOLS groups.

Download Weblogic 12.1.3.0 at:

http://www.oracle.com/technetwork/middleware/fusion-middleware/downloads/index.html

Install (see fig 1):

- Admin Server on port:7001
- Managed Server (on which the Drools Workbench will be installed) on port: 7003



Figure 1

Create two groups. Apparently Drools workbench relies on these two groups. Myream is the default Weblogic realm. Attach the groups to this realm.
Steps:
  1. Go to Domain-> Security realms-> myrealm.)
  2. Go to Tab "Users and Groups"
  3. Go to sub tab "Groups"
  4. Create groups
    •   admin
    •   analyst
  5. Create user "kieuser" and assign the two groups to it (fig. 2)

Figure 2


2. Set up a git local respository
Just a few points to make on git. Git is a version control system different in working than SVN.
Basically repositories are copied locally, what is called cloning. When changes are made, a user will commit his changes, however as opposed to SVN, commit does not communicate or persist changes to a remote git server, but moves changes to the HEAD, hence changes are still locally saved. A push operation will persist files to the remote server . A pull operation will update the local repository.

The Drools workbench features a builtin git server. Unfortunately, when deployed on Weblogic the embedded git server does not work. As a workaround we need to :
  • to create our local repository without having a git server:
    Reinit your git repo to enable sharing (man page)
    cd /myRepoDirectory
    git init --shared=yes
  • tell the workbench that the server is off and instead lead it to the git path. Make sure you specify the same path of git repository just created

    set JAVA_OPTIONS=-Djavax.xml.bind.context.factory=com.sun.xml.bind.v2.ContextFactory -Dorg.uberfire.start.method=ejb -Dorg.uberfire.domain=OracleDefaultLoginConfiguration -Dorg.kie.demo=false -Dorg.uberfire.nio.git.ssh.enabled=false -Dorg.uberfire.nio.git.daemon.enabled=false -Dorg.uberfire.nio.git.dir=/myRepoDirectory



3. Modify the workbench war archive
The workbench archive is available at this link:

http://www.drools.org/download/download.html

Application must be deployed as as folder to allow complete feature set to be activated. We have unpacked the war into a directory named droolsWB, hence the web app context will be also droolsWB
When unpacking the war, Windows will complain that your file system does accept such long file names as there is one class in the archive that is too long.

To resolve this, we are going to delete the long named class and add to our classpath a jar containing the same class. Steps:
  • open your archive explorer into the kie-drools-wb-distribution-wars-6.2.0.Final-weblogic12.war and delete de following file:
    org\jboss\errai\marshalling\server\impl\ServerMarshallingFactoryImpl$Marshaller_for_org_drools_workbench_models_guided_dtable_shared_model_adaptors_ActionInsertFactCol52ActionInsertLogicalFactAdaptorImpl.class
    The class is located under \WEB-INF\classes
  • As a workaround, we have packaged the long file in a jar. Add kie-drools-wb-distribution-wars-6.2.0.Final-weblogic12.jar  to your web app lib classpath. The jar is already read and can be downloaded here

4. Create a datasource


The workbench requires a datasource configuration. To allow easy setup, we have chosen a h2 in memory database. To download the jdbc driver, go to :

http://www.h2database.com/html/download.html

Make sure you download jar h2-1.4.190.jar

Add the jar under your Weblogic domain classpath at Your Domain\llib


Next we will setup jbpm datasource required by the workbench:
Make sure, you specify the jndi name as: jdbc/jbpm

  • Go to domain->Services->Data sources->New
  • set the following properties :
    • name :jbpm
    • jndi : jdbc/jbpm
    • Database Type: other
  • Press next
  • Leave Supports Global Transactions checked
  • Select radio button Emulate Two-Phase Commit
  • Enter database user properties
    • user :sa
    • password  : leave blank

  • Press next
  • Fill in driver properties (see figure 3):
    • Driver Class Name: jdbc:h2:mem:test
    • URL : org.h2.Driver

figure 3





5. Maven repository

The workbench will create a directory under your Weblogic domain file system in which it will puish the Maven artifacts. By default the respository will be placed under : \domain\repositories\kie\

If the intention is to change that directory, in managed server launch bat file, add the following JVM system property :

-Dorg.guvnor.m2repo.dir=Path to your Maven repository


6. JVM options 
In your managed launch server bat file add the following line:
set USER_MEM_ARGS=-Xms512m -Xmx1024m -XX:MaxPermSize=512m
Launch the managed server.
The context will appear under droolsWB (figure 4)
http://localhost:7003/droolsWB



About Me

My Photo