« Back

Building a Tomcat Bundle from Liferay trunk

Company Blogs March 8, 2010 By Edward Shin Staff

Update October 6, 2010: Now that we've officially packaged the bundles for Liferay 6 in both our CE and EE releases, you can now download the bundles from liferay.com instead of building them from scratch. This blog was based on an ongoing revision of trunk so some of the steps will be outdated at this time.

If you've ever wondered which Tomcat bundle to use when deploying Liferay trunk, you can actually build your own using build-dist.xml. This step is the first one needed to check out the new Plugins EXT environment.

In the past, I used to download the latest version of our Tomcat bundle from our website, but using build-dist.xml is easier and requires less steps. Once Liferay 6.0 is released, you'll be able to download the bundle directly from our website.

You can download trunk here using an svn client:
svn://svn.liferay.com/repos/public/portal/trunk

From the Liferay trunk directory, you can run:
ant all

And then:
ant -buildfile build-dist.xml zip-tomcat

Assuming that you checked out Liferay trunk to the following directory:

Running the commands will look something like this:

 

Threaded Replies Author Date
I notice when I create a tomcat bundle, it is... Jonathan Alvarado March 23, 2010 3:52 PM
Unfortunately, I don't have time to check this,... Edward Shin March 24, 2010 4:46 PM
How do I access You can download trunk here... jagit sethi January 19, 2011 2:52 PM
the first step "ant all" does not work either:... Mathias Schneider March 29, 2010 2:02 PM
The only four things which are important: - you... Mathias Schneider March 29, 2010 2:43 PM
Hi Mathias, A few clarifications: I updated to... Edward Shin March 29, 2010 3:39 PM
I just downloaded trunk and got the same error... Alex Wallace April 6, 2010 10:39 AM
heh... nope, the bundle doesn't have anything... Alex Wallace April 6, 2010 10:41 AM
Hi Jonathan, I just updated to revision 49446... Edward Shin March 29, 2010 3:19 PM
This may be topic for a forum thread instead.... Alex Wallace April 6, 2010 11:28 AM
Thank Edward and Alex, The ant clean start... Jonathan Alvarado April 23, 2010 10:11 AM
The combination of ant calls that worked for me... Alex Wallace April 6, 2010 11:37 AM
Hi! It worked for me with your instructions,... Juan Francisco Fernández Rodríguez April 13, 2010 2:00 AM
hi Edward, i had followed your steps for... ratna prasad kakani November 19, 2010 2:44 AM
hi edward, dont know where the problem is, i... ratna prasad kakani November 19, 2010 7:53 AM
[...] Building a Tomcat Bundle from Liferay... Anonymous September 9, 2011 7:57 PM

I notice when I create a tomcat bundle, it is missing many files (such as the tomcat startup scripts) that are found in a normal tomcat install, and in the zipped tomcat bundle. I am able to get these files from a different tomcat install, but I'm wondering why they are missing, or what process you use to add them to your bundle?
Posted on 3/23/10 3:52 PM.
Unfortunately, I don't have time to check this, but I think that's all I needed to do. The startup scripts were there, and I didn't need to do any additional work to include them. You might want to take a look at build-dist.xml to see if any changes were made.
Posted on 3/24/10 4:46 PM in reply to Jonathan Alvarado.
the first step "ant all" does not work either:
D:\Projekte\xy\workspace\Liferay_Portal\build.xml:650: D:\Projekte\xy\liferay\liferay-portal-6.0.0\tomcat-6.0.24\conf\catalina.properti­es doesn't exist
Posted on 3/29/10 2:02 PM in reply to Jonathan Alvarado.
The only four things which are important:
- you need to checkout liferay portal/trunk to create a java project in eclipse
- you need a clean tomcat installation (remember its folder)
- create the file app.server..properties in your project root directory as a copy from app.server..properties and modify app.server.zip.name, app.server.parent.dir and app.server.tomcat.dir to the tomcat folder
- run ant all (calls clean,start,deploy)
- additionaly you can run ant -buildfile build-dist.xml zip-tomcat to create a zip in /dist

Thats all :-)
Posted on 3/29/10 2:43 PM in reply to Mathias Schneider.
Hi Jonathan,

I just updated to revision 49446 (the latest revision as of right now), and the build script is downloading Tomcat directly from Apache's website. The startup scripts are definitely included in the download. You can go through the build script (build-dist.xml) to see why build scripts aren't being created for you.

I'll give you the high level to help you get started. The first thing that it does is call unzip-tomcat, and if you look inside the unzip-tomcat target, you'll see that it downloads Tomcat from the following location:

app.server.tomcat.zip.url=http://archive.apache.org/dist/tomcat/tomcat-­6/v6.0.24/bin/${app.server.tomcat.zip.name}

where ${app.server.tomcat.zip.name} = apache-tomcat-6.0.24.zip

http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.24/b­in/apache-tomcat-6.0.24.zip

If you download Tomcat from that URL, you'll see that the startup scripts are there. Start from there, and see at what point your startup scripts aren't being included.
Posted on 3/29/10 3:19 PM in reply to Jonathan Alvarado.
Hi Mathias,

A few clarifications:
I updated to revision 49446, and "ant all" runs successfully. I don't have any custom properties so this probably doesn't work for you because you have custom settings in your app.server.properties file.

The steps you listed are more of how to deploy to a server vs. building a Liferay Tomcat bundle although after looking at the build script, the steps are pretty similar.
Posted on 3/29/10 3:39 PM in reply to Mathias Schneider.
I just downloaded trunk and got the same error about catalina.properties not found. I am fairly sure that the build worked, but since i did not have a well configured app.server.properties it could not find the tomcat to deploy stuff to. It doesn't seem like a show stopper if one understands what's going on.

After i ran the target to create the tomcat bundle i unzipped it and configured app.server propperly... I'm running ant all again to see what happens.

Thanks!
Posted on 4/6/10 10:39 AM in reply to Edward Shin.
heh... nope, the bundle doesn't have anything in bin (except for sentenv.sh) and conf is also missing stuff... Researching...
Posted on 4/6/10 10:41 AM in reply to Alex Wallace.
This may be topic for a forum thread instead. zip-tomcat does not call unzip-tomcat in the build-dist.xml i just got from trunk. It simply deletes the old one and zips up a new one using app.server.tomcat.dir.

I also have no custom properties file...

I'll post the combination that worked for me as a new comment for cleanness.
Posted on 4/6/10 11:28 AM in reply to Edward Shin.
The combination of ant calls that worked for me are:

ant clean start
ant -buildfile build-dist.xml build-dist-tomcat

After that *ant all* calls work because now there is good tomcat to deploy to. (downloaded by unzip-tomcat called by build-dist-tomcat).

After that *ant zip-tomcat* should also work. While it was not failing with the given instructions, it was creating a zip that contained no tomcat stuff, just liferay stuff...

build-dist-tomcat looked like a good target, but there are other ant calls that will eventually produce the same thing.
Posted on 4/6/10 11:37 AM.
Hi!

It worked for me with your instructions, without that two previous ant calls it was giving a compile error (no catalina.properties found). Thanks to both, Alex and Edward!

Greets.
Posted on 4/13/10 2:00 AM in reply to Alex Wallace.
Thank Edward and Alex,

The

ant clean start
ant -buildfile build-dist.xml build-dist-tomcat

series of commands works for me.
Posted on 4/23/10 10:11 AM in reply to Edward Shin.
hi Edward,

i had followed your steps for building liferay from trunk,
have downloaded source from

svn://svn.liferay.com/repos/public/portal/trunk

executed the steps you have said, every thing went well, i have got the distribution file. i have able to start tomcat successfully with out any error. when i tried to login using test@liferay.com and test as password, it is showing blank screen. on tomcat console it is throwing an error

10:37:15,484 ERROR [velocity:151] Exception rendering #parse(_SERVLET_CONTEXT_/html/themes/_unstyled/templates/init.vm) at _SERVLET_CONTEXT_/html/themes/classic/templates/portal_normal.vm[line 3, column 1]
10:37:15,531 ERROR [IncludeTag:329] Current URL / generates exception: Invocation of method 'hasMyPlaces' in class com.liferay.portal.model.impl.UserImpl threw exception com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.QueryException: Expected positional parameter count: 24, actual parameters: [2, 1, null, null, null, null, null, 2, 1, null, null, null, null, null, 2, 1, null, null, null, null, null] [( SELECT Group_.groupId AS groupId, Group_.name AS groupName, Group_.type_ AS groupType, Group_.friendlyURL AS groupFriendlyURL FROM Group_ INNER JOIN Users_Groups ON (Users_Groups.groupId = Group_.groupId) WHERE (Group_.liveGroupId = 0) AND (Users_Groups.userId = ?) AND (Group_.companyId = ?) AND (Group_.classNameId
= ?) AND (Group_.liveGroupId = 0) AND (Group_.name != 'Control Panel') AND (lower(Group_.name) LIKE ? OR lower(Group_.name) LIKE ? OR ? IS NULL) AND (lower(Group_.description) LIKE ? OR ? IS NULL) AND (Group_.type_ != 4) ) UNION ( SELECT Group_.groupId AS groupId, Group_.name AS groupName, Group_.type_ AS groupType, Group_.friendlyURL AS groupFriendlyURL FROM Group_ INNER JOIN Groups_Orgs ON (Groups_Orgs.groupId = Group_.groupId) INNER JOIN Users_Orgs ON (Users_Orgs.organizationId = Groups_Orgs.organizationId) WHERE (Group_.liveGroupId = 0) AND (Users_Orgs.userId = ?) AND (Group_.companyId = ?) AND (Group_.classNameId = ?) AND (Group_.liveGroupId = 0) AND (Group_.name != 'Control Panel') AND (lower(Group_.name) LIKE ? OR lower(Group_.name) LIKE ? OR ? IS NULL) AND (lower(Group_.
description) LIKE ? OR ? IS NULL) AND (Group_.type_ != 4) ) UNION ( SELECT Group_.groupId AS groupId, Group_.name AS groupName, Group_.type_ AS groupType, Group_.friendlyURL AS groupFriendlyURL FROM Group_ INNER JOIN Groups_UserGroups ON (Groups_UserGroups.groupId = Group_.groupId) INNER JOIN Users_UserGroups ON (Users_UserGroups.userGroupId = Groups_UserGroups.userGroupId) WHERE (Group_.liveGroupId = 0) AND (Users_UserGroups.userId = ?) AND (Group_.companyId = ?) AND (Group_.classNameId = ?) AND (Group_.liveGroupId = 0) AND (Group_.name != 'Control Panel') AND (lower(Group_.name) LIKE ? OR lower(Group_.name) LIKE ? OR ? IS NULL) AND (lower(Group_.description) LIKE ? OR ? IS NULL) AND (Group_.type_ != 4) ) ORDER BY groupName ASC] at _SERVLET_CONTEXT_/html/themes/_unstyled/temp
lates/init.vm[line 278, column 31]
10:37:15,546 ERROR [IncludeTag:154] org.hibernate.QueryException: Expected positional parameter count: 24, actual parameters: [2, 1, null, null, null, null, null, 2, 1, null, null, null, null, null, 2, 1, null, null, null, null, null] [( SELECT Group_.groupId AS groupId, Group_.name AS groupName, Group_.type_ AS groupType, Group_.friendlyURL AS groupFriendlyURL FROM Group_ INNER JOIN Users_Groups ON (Users_Groups.groupId = Group_.groupId) WHERE (Group_.liveGroupId = 0) AND (Users_Groups.userId = ?) AND (Group_.companyId = ?) AND (Group_.classNameId = ?) AND (Group_.liveGroupId = 0) AND (Group_.name != 'Control Panel') AND (lower(Group_.name) LIKE ? OR lower(Group_.name) LIKE ? OR ? IS NULL) AND (lower(Group_.description) LIKE ? OR ? IS NULL) AND (Group_.type_ != 4) ) UNION ( SE
LECT Group_.groupId AS groupId, Group_.name AS groupName, Group_.type_ AS groupType, Group_.friendlyURL AS groupFriendlyURL FROM Group_ INNER JOIN Groups_Orgs ON (Groups_Orgs.groupId = Group_.groupId) INNER JOIN Users_Orgs ON (Users_Orgs.organizationId = Groups_Orgs.organizationId) WHERE (Group_.liveGroupId = 0) AND (Users_Orgs.userId = ?) AND (Group_.companyId = ?) AND (Group_.classNameId = ?) AND (Group_.liveGroupId = 0) AND (Group_.name != 'Control Panel') AND (lower(Group_.name) LIKE ? OR lower(Group_.name) LIKE ? OR ? IS NULL) AND (lower(Group_.description) LIKE ? OR ? IS NULL) AND (Group_.type_ != 4) ) UNION ( SELECT Group_.groupId AS groupId, Group_.name AS groupName, Group_.type_ AS groupType, Group_.friendlyURL AS groupFriendlyURL FROM Group_ INNER JOIN Groups_UserGro
ups ON (Groups_UserGroups.groupId = Group_.groupId) INNER JOIN Users_UserGroups ON (Users_UserGroups.userGroupId = Groups_UserGroups.userGroupId) WHERE (Group_.liveGroupId = 0) AND (Users_UserGroups.userId = ?) AND (Group_.companyId = ?) AND (Group_.classNameId = ?) AND (Group_.liveGroupId = 0) AND (Group_.name != 'Control Panel') AND (lower(Group_.name) LIKE ? OR lower(Group_.name) LIKE ? OR ? IS NULL) AND (lower(Group_.description) LIKE ? OR ? IS NULL) AND (Group_.type_ != 4) ) ORDER BY groupName ASC]
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:367­)
at org.hibernate.impl.SQLQueryImpl.verifyParameters(SQLQueryImpl.java:209)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:86)
at com.liferay.portal.kernel.dao.orm.QueryUtil.list(QueryUtil.java:67)
at com.liferay.portal.kernel.dao.orm.QueryUtil.list(QueryUtil.java:52)
at com.liferay.portal.kernel.dao.orm.QueryUtil.iterate(QueryUtil.java:46)
at com.liferay.portal.kernel.dao.orm.QueryUtil.iterate(QueryUtil.java:39)
at com.liferay.portal.service.persistence.GroupFinderImpl.findByC_N_D(GroupFinderIm­pl.java:484)
at com.liferay.portal.service.impl.GroupLocalServiceImpl.search(GroupLocalServiceIm­pl.java:808)
at com.liferay.portal.service.impl.GroupLocalServiceImpl.search(GroupLocalServiceIm­pl.java:793)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionI­nterceptor.java:86)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice­.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice­.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice­.java:58)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice­.java:58)
at com.liferay.portal.service.GroupLocalServiceUtil.search(GroupLocalServiceUtil.ja­va:464)
at com.liferay.portal.model.impl.UserImpl.getMyPlaces(UserImpl.java:306)
at com.liferay.portal.model.impl.UserImpl.getMyPlaces(UserImpl.java:259)
at com.liferay.portal.model.impl.UserImpl.hasMyPlaces(UserImpl.java:578)


need help, thank you
Posted on 11/19/10 2:44 AM.
hi edward,

dont know where the problem is, i have again downloaded the source from svn, recompiled then with the steps you have given it worked well, Nice post it has helped me a lot, thank you once gain.

regards
Posted on 11/19/10 7:53 AM in reply to ratna prasad kakani.
How do I access

You can download trunk here using an svn client:
svn://svn.liferay.com/repos/public/portal/trunk
Thanks
jay
Posted on 1/19/11 2:52 PM in reply to Edward Shin.
[...] Building a Tomcat Bundle from Liferay trunk – Blog – Liferay.com Mar 8, 2010 … While it was not failing with the given instructions, it was creating a zip that contained no tomcat stuff, just liferay... [...] Read More
Posted on 9/9/11 7:57 PM.