The Purpose of this Post

This post is an example of an easy setup of Drools KIE WorkBench and KIE Server in one WildFly server instance.

Note 1: These notes use WildFly 8.2.1 for compatibility with Drools 6.4.0.  Adjust the paths accordingly for a different version.

Note 2: These instructions use Windows syntax for directories but the steps are the same for Linux.

Install WildFly

If you don’t have WildFly installed, these instructions may help.

There is no need to have WildFly running when installing and configuring KIE products.  If you have it running, ignore the errors until completing configuration.

KIE WorkBench

Download Drools KIE WorkBench 6.4.0

Copy the war file to C:\apps\wildfly-8.2.1.Final\standalone\deployments\ directory.  WildFly will auto deploy it when started (or nearly immediately if it is already running).

KIE Server

Download Drools KIE Server 6.4.0

Extract kie-server-6.4.0.Final-ee7.war from the zip.

Copy the war file to C:\apps\wildfly-8.2.1.Final\standalone\deployments\ directory.  WildFly will auto deploy it when started (or nearly immediately if it is already running).

Add Users

KIE WorkBench and KIE Server require roles for various privileges.  For our quick setup, create a user named “kieserver” with same word as password and roles for all privileges.

To do so, run this command in the WildFly bin directory:

add-user -a -u kieserver -p kieserver -ro admin,kie-server,rest-all,kiemgmt

Consider creating separate users – one for KIE Server and KIE WorkBench communication (as above) and one for each human user to author rules (the user ids).

Configure

While configuring the KIE products isn’t difficult, I’ve seen many people miss settings or have wrong values for settings and then struggle with what is wrong.  This is the key reason for this post – a nutshell of correct settings for a fast and simple setup.

One of the easier ways to configure apps in WildFly is using the conf files in the WildFly bin directory.  Add these config items towards the top of the C:\apps\wildfly-8.2.1.Final\bin\standalone.conf.bat file.

For clarity, I make a separate environment variables for each item.

KIE Server requires the full WildFly config:

set SERVER_CONFIG=--server-config=standalone-full.xml

Establish the user ids and passwords for KIE Server and KIE WorkBench communication.  For our quick setup, use the same user for both needs; use the user created earlier:

set KIE_SERVER_USER=-Dorg.kie.server.user=kieserver
set KIE_SERVER_PWD=-Dorg.kie.server.pwd=kieserver
set KIE_CONTROLLER_USER=-Dorg.kie.server.controller.user=kieserver
set KIE_CONTROLLER_PWD=-Dorg.kie.server.controller.pwd=kieserver

Establish the URLs for KIE WorkBench controller and KIE Server REST:

set KIE_CONTROLLER_URL=http://localhost:8080/kie-drools-wb-distribution-wars-6.4.0.Final-wildfly8/rest/controller
set KIE_SERVER_URL=http://localhost:8080/kie-server-6.4.0.Final-ee7/services/rest/server
set KIE_SERVER=-Dorg.kie.server.location=%KIE_SERVER_URL%
set KIE_CONTROLLER=-Dorg.kie.server.controller=%KIE_CONTROLLER_URL%

Establish the name of the KIE Server.  When creating a “server template” in KIE WorkBench, its name must match the name of a KIE Server id.  Also, the KIE WorkBench displays this name for the KIE Server when the KIE Server connects to the KIE WorkBench:

set KIE_SERVER_ID=-Dorg.kie.server.id=wildfly-kieserver

WildFly uses an environment variable named SERVER_OPTS for configuration options, so concatenate the individual environment variables into it:

set SERVER_OPTS=%SERVER_CONFIG% %KIE_SERVER_USER% %KIE_SERVER_PWD% %KIE_CONTROLLER_USER% %KIE_CONTROLLER_PWD% %KIE_SERVER% %KIE_CONTROLLER% %KIE_SERVER_ID%

(don’t forget to save the file!)

Run and Verify

Start (or restart) WildFly and monitor the log messages for errors.

Note: until the KIE WorkBench is fully started, the KIE Server cannot connect to it and it emits a 405 connection problem until it can.  This message stops once they are both running, if it doesn’t then you have a config issue.

If working correctly, this URL shows the KIE WorkBench login page: http://localhost:8080/kie-drools-wb-distribution-wars-6.4.0.Final-wildfly8/

Login with a user id and password created above.

If the login page does not appear, then review the WildFly server log and the deployment status files in the standalone dir.

This REST URL shows the KIE Server status: http://localhost:8080/kie-server-6.4.0.Final-ee7/services/rest/server/

This REST URL shows the KIE Server containers configured to it: http://localhost:8080/kie-server-6.4.0.Final-ee7/services/rest/server/containers

KIE WorkBench and KIE Server have many REST URLs to work with, so explore the Drools docs to see them.

Hopefully these steps helped your quick setup of the Drools KIE WorkBench and KIE Server.  Please let me know if I can expand on any of them for clarity.