Home Liferay JTA Integration with Liferay Tomcat Using JOTM

JTA Integration with Liferay Tomcat Using JOTM

Liferay Version : 6.0.6 CE Tomcat

LR Gurus,

For any enterprise level of application, Transaction is most important thing to create reliability and generate faith in users towards application. If it fails to do so it will loose popularity.


Recently we have faced such situation in one of our project where we were updating multiple services, some of them were portal services like groups, roles, journal-article and others, and rest of them were our custom developed services (using service builder). There are bunch of issues we faced and we are sure many of you have facing the same,

  • By default Liferay supports Hibernate Transaction Manager which do not supports distributed transaction management. It means when objects from different contexts are updating , Hibernate Transaction Manager is not able cope with that. Only portal objects are getting roll backed when exception is thrown.
  • In our case we are updating objects from portal services and custom objects from portlet level services are in different contexts.
  • Liferay supports JTA transaction manager which able to handle distributed transaction management. Good to hear that!!! But now the problem is that Tomcat doesn’t support JTA directly.
  • JOTM is the solution to integrate JTA transaction manager with Tomcat. In our case we are using Liferay Tomcat.


  • Need to enable following properties in portal-ext.properties. We are using JNDI configuration for database connection.




This will indicate the Liferay to use JTA transaction manager rather than the default one

  • Modify your context.xml for JNDI configuration like this,

<Resource name=”UserTransaction”
type=”javax.transaction.UserTransaction” />

<Transaction factory=”org.objectweb.jotm.UserTransactionFactory”
jotm.timeout=”60″ />


  • Basically one needs to change the type with javax.sql.DataSource and factory with org.objectweb.jotm.datasource.DataSourceFactory. Here DataSourceFactory class part of JOTM liberaries. We need to put several jars in Tomcat
  • Here we have attached the zip of jar files which needs to be unzipped and one need to copy all the jars and put into global lib directory of Tomcat {TOMCATE_HOME}/lib/ext/
  • Once all the steps followed one has to restart the Liferay Tomcat and look for any errors.
  • If no error while startup that means JTA has been integrated successfully. Now your transaction should rollback all the objects in case of any exception.

We hope that this blog post will help you to solve biggest architecture level issue. Feel free to contact us Liferay portal development companies at info@scalsys.com in case of any queries.

Thanks & Regards,

ScalSys Team



Share!Share on FacebookShare on Google+Share on LinkedInTweet about this on TwitterFlattr the authorDigg thisPin on PinterestEmail this to someoneShare on StumbleUponShare on RedditShare on TumblrBuffer this pagePrint this page
Comments Off on JTA Integration with Liferay Tomcat Using JOTM.
Copyright © 2017 - Scalsys. All Rights Reserved