Friday, April 11, 2014

Deploying kie-drools-wb on Tomcat

There have been a few emails recently to the Drools User mailing list stating problems deploying KIE Drools Workbench to Tomcat. We had a run of them shortly after the initial release of 6.0.1 too.

Suspecting there might be an issue I thought there be no better way to spend a Friday afternoon than to take a look and give it a try. In short I was able to deploy both 6.0.1 and 6.1.0-SNAPSHOT to Tomcat 7 with little problem.

Most of what I type below is already included in the Tomcat WAR's README.txt. This is tucked away inside the WAR and hence not blatantly obvious to some.

6.0.1

Starting with a clean install of Tomcat 7.

1. Copy "kie-tomcat-integration" JAR into TOMCAT_HOME/lib (org.kie:kie-tomcat-integration)
2. Copy "JACC" JAR into TOMCAT_HOME/lib (javax.security.jacc:artifactId=javax.security.jacc-api in JBoss Maven Repository)
3. Copy "slf4j-api" JAR into TOMCAT_HOME/lib (org.slf4j:artifactId=slf4j-api in JBoss Maven Repository)
4. Add valve configuration into TOMCAT_HOME/conf/server.xml inside <Host> element as last valve definition:

   <Valve className="org.kie.integration.tomcat.JACCValve" />

5. Edit TOMCAT_HOME/conf/tomcat-users.xml to include roles and users, make sure there will be 'analyst' or 'admin' roles defined as it's required to be authorized to use kie-drools-wb
6. Delete org.uberfire.security.auth.AuthenticationSource inside WEB-INF/classes/META-INF/services
7. Rename org.uberfire.security.auth.AuthenticationSource-TOMCAT-JEE-SECURITY to org.uberfire.security.auth.AuthenticationSource inside WEB-INF/classes/META-INF/services
8. Increase Java's PermGen space by adding file TOMCAT_HOME/bin/setenv.sh containing export JAVA_OPTS="-Xmx1024m -XX:MaxPermSize=256m"
9. Start Tomcat with TOMCAT_HOME/bin/startup.sh
10. Go to Management Console, http://localhost:8080/management
11. Deploy modified WAR

If you do not complete these steps the WAR works "out of the box" but you'll need to define Users in WEB-INF/classes/users.properties

6.1.0-SNAPSHOT

Starting with a clean install of Tomcat 7.

1. Copy "kie-tomcat-integration" JAR into TOMCAT_HOME/lib (org.kie:kie-tomcat-integration)
2. Copy "JACC" JAR into TOMCAT_HOME/lib (javax.security.jacc:artifactId=javax.security.jacc-api in JBoss Maven Repository)
3. Copy "slf4j-api" JAR into TOMCAT_HOME/lib (org.slf4j:artifactId=slf4j-api in JBoss Maven Repository)
4. Add valve configuration into TOMCAT_HOME/conf/server.xml inside Host element as last valve definition:

   <Valve className="org.kie.integration.tomcat.JACCValve" />

5. Edit TOMCAT_HOME/conf/tomcat-users.xml to include roles and users, make sure there will be 'analyst' or 'admin' roles defined as it's required to be authorized to use kie-drools-wb
6. Start Tomcat with TOMCAT_HOME/bin/startup.sh
7. Go to Management Console, http://localhost:8080/management
8. Deploy modified WAR

The differences between 6.0.1 and 6.1.0 are caused by where we've cleared up some of the code committed to the release branch in between releases.