I am going to explain how you can startup drools-wb on Apache Tomcat as windows service. Version 6.3 has been tested on tomcat 7 and java 7. I am just going to use default db, h2 database to make the setup clean. It is also configured to use realm backed by tomcat-users.xml
- Make sure you have Java installed and environment variables setup(JAVA_HOME and path). You just need java jre but I am ok with JDK too.
- Download Apache Tomcat 7 if you don't have yet. Please select correct distro and install as service. Please check Apache-Tomcat-guide if you need any help. Make sure you have set env for CATALINA_HOME. Mine is
CATALINA_HOME=C:\T7. - Download Tomcat 7+ WAR version 6.3.0 final directly.
- Extract the downloaded .war file to drools-wb(this will be my app name or context.) folder. You can extract war file using zip tools. Easiest way would be change the extension from .war to .zip, then unzip to the folder. Then move drools-wb folder into
CATALINA_HOME/webappsfolder. - Next, clone my repo and follow the steps:
- Copy all jars from btm-dependencies folder into your CATALINA_HOME/lib
- Copy btm-config.properties and resources.properties from repo into your CATALINA_HOME/conf. Make sure resource.properties has correct value set for resource.ds1.driverProperties.url key. Mine is
resource.ds1.driverProperties.url=jdbc:h2:file:C:/T7/jbpm - Go to your CATALINA_HOME/bin and open tomcat7w.exe and add following java options:
-Dbtm.root=C:\T7 -Dbitronix.tm.configuration=C:\T7\conf\btm-config.properties -Djbpm.tsr.jndi.lookup=java:comp\env\TransactionSynchronizationRegistry -Djava.security.auth.login.config=C:\T7\webapps\drools-wb\WEB-INF\classes\login.config -Dorg.jboss.logging.provider=jdk -Xms512m -Xmx2048m -XX:MaxPermSize=512m- Add valve configuration into CATALINA_HOME/conf/server.xml inside Host element as last valve definition:
- Finally, make sure CATALINA_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 drools-wb
- Now start the tomcat service.
http://localhost:8080/drools-wbshould bring the login screen and you should be able to use the tomcat user.
Troubleshooting
If you encounter following exceptions:
java.lang.ClassNotFoundException: bitronix.tm.integration.tomcat55.BTMLifecycleListener
This normally happens when you miss to include the dependencies mentions above at how to setup drools.
javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.domain] Unable to build EntityManagerFactory
bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named jdbc/jbpm
Probably your setting for resource.ds1.driverProperties.url on resources.properties is not right. Mine looks like this
resource.ds1.driverProperties.url=jdbc:h2:file:c:\tomcat7\tmpINFO: RESTEASY000305: Adding scanned resource: org.kie.server.controller.rest.RestKieServerControllerAdminImpl
Dec 17, 2015 2:52:58 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Dec 17, 2015 2:52:58 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/drools-wb] startup failed due to previous errors
Dec 17, 2015 2:52:58 PM org.jboss.errai.cdi.server.events.ShutdownEventObserver notify
INFO: Shutting down CDI-to-ErraiBus event bridge
Dec 17, 2015 2:52:58 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [/drools-wb] appears to have started a thread named [Thread-7] but has failed to stop it. This is very likely to create a memory leak.
Dec 17, 2015 2:52:58 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
You need to delete all cache and .index/.niogit/.security folder. I find these errors when I have some manual changes on folder, especially .niogit folder. Actually, you are not supposed to touch these folders. I was just experimenting in terms of migration.
2 comments:
Hi! Thank you very much for the helpful post.. I am trying to follow these steps. I couldn't make sure which value to assign to the following configuration: isresource.ds1.driverProperties.url=jdbc:h2:file:C:/T7/jbpm
Can you give some information on that? Thanks!
to any existing folder should work. The folder is basically where jbpm file are stored.
Post a Comment