Over a million developers have joined DZone.

How To: Configuration Instructions for Activiti-5.0.alpha4 to Work With MySQL 5.1.49

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

The following tutorial will help you configure activiti-5.0.alpha4 to work with MySQL 5.x, and let you have a correct setup configuration and a startup execution without any problems. You may think that Activiti's documentation already has the instructions for configuration and installation. That's correct, but after reading the instructions, I realized that some steps are missing.  Some tricks are mandatory and a bug exists.  Therefore, I am sharing my experience so that you can avoid a headache.

The following software is mandatory. I am using the latest release versions available for many of them.

  • activiti-5.0.alpha4
  • apache ant 1.8.1
  • tomcat 6.0.29
  • jdk1.6.0_21
  • MySQL 5.1.49 - Community Server
  • MySQL Java Driver Connector 5.1.13

I assume that all, apart from activiti, are already installed and well configured. OK let's go

The First step is unzip the activiti-5.0.alpha4.zip file to some specific location, for example D:\applications\activiti\activiti-5.0.alpha4. For now I am going to use ...\activiti\activiti-5.0.alpha4 format.

The Second step is configure some .properties files. Therefore in ...\activiti\activiti-5.0.alpha4\setup you are going to see the follow files

  • files (directory)
  • build.h2.properties
  • build.mysql.properties
  • build.properties
  • build.xml

Open build.properties, you going to see the follow content

# The db property should refer to the type of database that
# you want to use. Currently only h2 and MySQL is supported.

# The tx property refers to the transaction environment
# you want to use. Choose from {standalone}

# Specify the version of Tomcat that you want to use.
# We only tested with the given Tomcat version but in
# theory any tomcat 6.0.x version should do fine.

# If you have tomcat already downloaded, point the
# downloads.dir property to that directly. If tomcat is
# not found in the downloads.dir, it will be automatically
# downloaded there.
# The downloads directory should be outside of /target/
# to avoid re-downloading after a clean

There are some lines about that we must change. Therefore do the following:

  • change db=h2 to db=mysql
  • change tomcat.version=6.0.26 to tomcat.version=6.0.29 (or your custom version)
  • change downloads.dir=../../../downloads to downloads.dir=D:/installerrepository/apache/tomcat/6.0.29

Notice that I am using in the path the character / and not \ which is the normal used in Windows path I mean:

  • D:/installerrepository/apache/tomcat/6.0.29 (you must use)
  • D:\installerrepository\apache\tomcat\6.0.29 (used by Windows)

Note: Be sure that in your downloads.dir path target your tomcat installer with extension .zip like apache-tomcat-6.0.29.zip exists. Why? Because in the file build.xml there is an ant target called tomcat.install which has these lines:

<property name="tomcat.distro" value="${downloads.dir}/${tomcat.filename}" />
<available property="is.tomcat.available" file="${tomcat.distro}" />

where ${downloads.dir} is defined in build.properties and ${tomcat.filename} is defined in the beginning of our build.xml file how you can see below.

<property name="tomcat.filename" value="apache-tomcat-${tomcat.version}.zip" />  

Notice the .zip in the value's attribute and that apache-tomcat-${tomcat.version}.zip was defined in build.properties. Be advised that if the tomcat installer (.zip) is not found it in the downloads.dir target directory, then the ant target would proceed to download Tomcat from Internet. See the target (tomcat.install) for more details.

The third step is configure build.mysql.properties, would be only necessary change the username and password




The fourth step is create a database in MySQL called activiti. Such a name must be used because was defined in the file build.mysql.properties with the property jdbc.url.

The fifth step is copy our MySQL java driver connector, like mysql-connector-java-5.1.13-bin.jar to ...\activiti\activiti-5.0.alpha4\lib directory.

The sixth step is important, because is not included in Activiti's documentation. In the following directory ...activiti\activiti-5.0.alpha4\setup\files\demo there is a unique file called h2.data.sql. Copy and paste the file in the same directory and rename it to mysql.data.sql.

The seventh step is very important because there is a bug that I found:  two JIRA issues were already created, one for this bug and the second of an error message that is not very useful related with the previous bug. In the follow ant task called deploy-bar just add the follow line <include name="mysql-*.jar"/> below of <include name="h2-*.jar"/>, thanks to Eran Riesenfeld to help me in resolve this problem.

That's all, with the all previous instructions, you can now open a console or terminal and go to ...\activiti\activiti-5.0.alpha4\setup directory and run the ant command or ant demo.setup which is the default target in our build.xml file.

After the ant command execution, you going to see some new directorie(s) created within ...\activiti\activiti-5.0.alpha4\setup and ...\activiti\activiti-5.0.alpha4\, futhermore of some files, and in your console or terminal you going to read a long output related with the creation of directories, unzip and copy of tomcat installer into a specific Activiti's directory, creation of tables in the activiti database, copy of the examples available in Activiti distribution, the creation of a .bar file and the startup of tomcat. Perhaps other things that perhaps I am forgetting, but the most important are mentioned above.

Now you are ready to open your Web Browser and test the follow:

Webapp Name URL Description
Activiti Probe http://localhost:8080/activiti-probe The admin management console. Use this tool to see if the configured process engine is correctly initialized, DB tables contents.
Activiti Explorer http://localhost:8080/activiti-explorer The process engine user console. Use this tool to view your personal and candidate task lists and to complete tasks.
Activiti Modeler powered by Signavio http://localhost:8080/activiti-modeler/p/explorer The web based process designer tool. Use this tool to graphically author BPMN 2.0 compliant process definitions files.

I hope that this tutorial be useful for you, this same tutorial is in my blog, along with other things too

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}