How To: Configurations Instructions for Activiti-5.0.alpha4 to work with MySQL 5.1.49

Home

The follow tutorial must help you to configure activiti-5.0.alpha4 to work with MySQL 5.x, to let you have a correct setup configuration and a startup execution without any problems. You perhaps could be thinking that right now exists in Activiti’s documentation the instructions for configuration and installation, that’s correct, but after to follow such instructions, I did realize that some steps are missing, some tricks are mandatory and a bug exists. Therefore I am sharing my experience solution to avoid you a headache.

The follow softwares are mandatory. I am using practically the last release versions available of 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, but except for 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. Since now I 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 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.
db=h2

# The tx property refers to the transaction environment
# you want to use. Choose from {standalone}
tx=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.
tomcat.version=6.0.26

# 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
downloads.dir=../../../downloads

The bold lines are the lines that we must to change. Therefore do the follow

  • 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, of course, or your custom location

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 exists your tomcat installer with extension .zip like apache-tomcat-6.0.29.zip, Why?, because in the build.xml file exists an ant target called tomcat.install which has these lines:

Help yourself matching the colors for a better understanding

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

where ${downloads.dir} was defined in build.properties file 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 ${tomcat.version} was defined too in build.properties file. Be advice 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 such target (tomcat.install) for more details.

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

db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username=yourusername
jdbc.password=yourpassword

The Fourth step is create a database in mysql called activiti. Such name must be used because was defined in the build.mysql.properties file 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 follow directory …activiti\activiti-5.0.alpha4\setup\files\demo exists a unique file called
h2.data.sql, copy and paste such file in the same directory and rename it to mysql.data.sql.

The Seventh step is very important because is a bug that I found it, two JIRA issues were already created, one for this bug and the second about of an error message not very useful related with the previous bug, OK then 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.

Home

18 thoughts on “How To: Configurations Instructions for Activiti-5.0.alpha4 to work with MySQL 5.1.49

    • Hello Dmitry

      I have read your error stack trace

      1) Are you using the same versions of the software used by me?
      2) About

      com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes

      The error is by Mysql side, be sure you have an updated Java Driver Connector version and Mysql Server too

      I will wait your reply, regards!

  1. Hi manueljordan,

    Thank you so much for this post since the installation guide on activiti site is vague and not detailed.
    Anyway, after performing ant, I receive an error
    BUILD FAILED
    /home/activiti/activiti/setup/build.xml:72: Class Not Found: JDBC driver com.mysql.jdbc.Driver could not be loaded

    The complete log message is posted here:

  2. I’m sorry but please disregard my previous post. It turns out that the connector was not yet extracted. my bad.
    Anyway after running ant again, I received the same error of Dmitry
    BUILD FAILED
    /home/activiti/activiti/setup/build.xml:72: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
    BTW I’m using Ubuntu 9.10
    * activiti-5.0.beta1
    * apache ant 1.8.1
    * tomcat 6.0.20
    * jdk1.6.0_20
    * MySQL 5.1.37 – Community Server
    * MySQL Java Driver Connector 5.1.13

    • Hello John

      Thanks for your words

      About the Mysql error is not related with Activiti. I did a fast research in google and seems to be related about the *char-set* that you are using for mysql, which is? latin1 of utf8?

      BTW I use the Alpha version, since I have problems with bugs in Beta1

      Best Regards

      • Wow thanks. You’re right when I set mysql to latin1 instead of utf8 it worked. Now my problem is that I can now access activit-probe. But I can’t login. I tried these usernames and password but didn’t work. (admin,admin), (kermit,kermit), (gonzo,gonzo), (fozzie,fozzie) based from http://www.activiti.org/userguide/index.html

        Thanks.

    • I finally made it work. =)
      What I did is to install activiti again on a fresh Ubuntu 9.10.
      Then after following your guide, I when I logged in I receive the error
      HTTP Status 500

      org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.extensions.surf.exception.UserFactoryException: Unable to retrieve user from repository
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:659)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      …..

      The fix was just to copy the mysql-connector-java-5.1.13-bin.jar to apache-tomcat lib.
      Actually I decided to use alpha4, later I’ll try the beta1.
      Thanks again..

  3. Hi Manuel,

    I have a new question. It seems that activiti-probe, activiti-modeler/p/explorer, and activiti-explorer are working fine but not activiti-cycle.

    Also would like to ask that is this just a demo? Can’t a add users and use this app for our company?
    Regards,
    John

    • Hello John

      >>but not activiti-cycle.
      Some special stack trace error?, if yes, share it in the forum

      >>Also would like to ask that is this just a demo?
      >>Can’t a add users and use this app for our company?
      I am not a member of Activiti, the exact answer I don’t know, try in the forum, help in a first hand you should get soon

      I am waiting a more stable version, by the moment I am in experiments with Flex not Activiti

      My Best Regards

  4. Hello John

    >>Oh I see..
    >>Thank you again for the quick response and assistance.
    You’re welcome, thanks for participate here =)

    >>Good Luck in your endeavors.
    Thanks a lot, I hope see you in Activiti’s Forums sharing your experiences

    My Best Regards

  5. hi ,
    i followed your installation guide, everything worked but except activiti kick start and activiti administrator is not working
    i got exception for kickstart like
    avax.servlet.ServletException: java.lang.NullPointerException
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:973)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:530)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause

    java.lang.NullPointerException
    org.activiti.kickstart.service.KickstartServiceImpl.(KickstartServiceImpl.java:68)
    org.activiti.kickstart.service.ServiceLocator.getAdhocWorkflowService(ServiceLocator.java:33)
    org.activiti.kickstart.ui.panel.KickstartWorkflowPanel.init(KickstartWorkflowPanel.java:81)
    org.activiti.kickstart.ui.panel.KickstartWorkflowPanel.(KickstartWorkflowPanel.java:71)
    org.activiti.kickstart.ui.panel.KickstartWorkflowPanel.(KickstartWorkflowPanel.java:75)
    org.activiti.kickstart.KickStartApplication.initDefaultWorkArea(KickStartApplication.java:87)
    org.activiti.kickstart.KickStartApplication.init(KickStartApplication.java:48)
    com.vaadin.Application.start(Application.java:554)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1182)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:466)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    for administrator–

    javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘adminApp’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.activiti.administrator.service.AuthenticationService org.activiti.administrator.AdminApp.authenticationService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘authenticationService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.activiti.engine.IdentityService org.activiti.administrator.service.AuthenticationServiceImpl.identityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine’: FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.h2.jdbc.JdbcSQLException: Connection is broken: “session closed” [90067-132]
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:973)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:530)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘adminApp’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.activiti.administrator.service.AuthenticationService org.activiti.administrator.AdminApp.authenticationService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘authenticationService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.activiti.engine.IdentityService org.activiti.administrator.service.AuthenticationServiceImpl.identityService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngine’: FactoryBean threw exception on object creation; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is org.h2.jdbc.JdbcSQLException: Connection is broken: “session closed” [90067-132]
    org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:329)
    org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
    org.springframework.web.context.request.SessionScope.get(SessionScope.java:92)
    org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:325)
    org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075)
    org.activiti.servlet.SpringApplicationServlet.getNewApplication(SpringApplicationServlet.java:57)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:947)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:775)
    com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:438)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

    • Hello

      Your error is nothing related with my code

      Seems that your error start here

      Could not open JDBC Connection for transaction; nested exception is org.h2.jdbc.JdbcSQLException: Connection is broken: “session closed” [90067-132]

      Check your own configuration

Leave a reply to John Cancel reply