Liferay and Tomcat – part 2

Here are some more detailed steps I took to get Liferay and Tomcat to work together. Then, I’ll share some more interesting data and observations.

For those hardware/OS minded folks, these experiments are being conducted on a Dell Latitude 620 2.33 GHZ Intel Centrino Duo running Windows XP SP 2, 2 GB of RAM.

So to recap, I settled on the technique of replacing Liferay’s suggested ROOT.xml file in conf/Catalina/localhost with an XML file named liferay.xml. I decided not to go with the technique of creating a context.xml file in webapps/liferay/META-INF. Note to reader: these path fragments are relative to what I’ve defined as CATALINA_HOME for this instance of Tomcat.

Well, the next thing that Liferay required that I didn’t have configured was the jaas.config file – it needed to live in the plain old conf directory.

Next step: JAVA_OPTS. It’s important to make sure that you crank the memory settings for Tomcat, and that you give Tomcat a clue as to the location of the jaas.config file.

Next, I followed an instruction I found in the Liferay forums that advised creating the file webapps/liferay/WEB-INF/classes/ with the following content:


I’m not certain if this indeed has the effect it’s supposed to, but it sounded like a reasonable thing to attempt.

Well, I was hopeful and tried cranking up Tomcat – but it died again. Basically, I did not have this line in conf/ configured correctly:


But once I fixed that, the portal tried to load – and the connection to the database blew up.

The reason was simple: I had installed MySQL Community Server 5.0.41, and the default security for MySQL is much stricter that it has been in the past. So, I simply had to create a user and a password, and issue a GRANT ALL on the ‘lportal’ database – then update my Context settings in liferay.xml to include the username and passwords in the JDBC connector data.

Life is good. The portal runs.

Liferay and Tomcat

The road less traveled…

Well, of course, I am attempting to go my own way on this one. I want to install Liferay 4.2.2 on Tomcat 5.5.23 without having Liferay become the root context. In other words, I want my Liferay and I want my other webapps, too.

Why am I being fussy about this? Well, I don’t know. I’m not particularly attached to the default Tomcat homepage, straight out of the box. But I guess I just want finer-grained control over my Tomcat webapps. That way, if I wanted to install another rev or Liferay, or another CMS someplace else, I can just configure such as I please and assign a new URL for it – rather than getting confused about which Liferay is currently at the root context.

So, here I am following the directions and installing Liferay. “Connect the dots… La la la la…” Well, I’ve gotten to the part where I’ve renamed the file ROOT.xml to liferay.xml…

Well, things didn’t work right off the bat because I didn’t have log4j installed. So, I downloaded it and tried to compile it, but this being a fresh computer, I didn’t have ant, so I went and got that.

I tried to compile log4j and got an “invalid target: 1.1” error, which upon further research, I found a post which suggested I downgrade my Java JDK – which I did, since I’m not doing anything that takes advantage of the new JDK.

To get log4j working in Tomcat, I added the log4j-1.2.14.jar to $CATALINA_HOME/common/lib/ , then I grabbed a basic configuration example from the web and put the log4j config file at $CATALINA_HOME/common/classes/ I cranked Tomcat, and life was good, as far as fixing the “Set up logging properly” error goes.

Now it’s just plain old blowing up – Liferay won’t start properly. But at least now I have logging, so I know where the stack trace goes now….