Sunday, October 31, 2010

Googled this one yet? "Data truncated for column 'createDate' at row 1"

This is an interesting case study.

So you're facing a problem in your Liferay 5.2 install (running on Apache Tomcat) where you can't add threads to the message boards, reply to threads, add or edit WIki pages... nada. Everytime you try you get the error message saying the portlet is temporarily unavailable.

Looking in the Catalina.out log you see that an error was logged, preceding a series of exceptions. The error: "Data truncated for column 'createDate' at row 1"

The createDate field in question is in the table SocialActivity in the lportal database.

The backstory:

A Liferay 5.2.3 portal site was to be upgraded to Liferay 6. The new portal was configured to point to the old portal database and the upgrade process began. For whatever reason the upgrade failed so the old 5.2 portal was restarted until the problem could be fixed. Mysteriously, people could suddenly no longer add any social content, like message board threads or Wiki pages.

Here's the problem. In Liferay 5.2 the SocialActivity table's createDate column is a DATETIME field. In Liferay 6 it's a BIGINT. When the upgrade process was running it changed the column type. By going back to Liferay 5.2 and trying to add social content, we're asking the portal to store a DATETIME value into a BIGINT field.


So that field type needs to be changed back to DATETIME or a backup of the database needs to be restored. (You did backup the database, right?)

Wednesday, October 27, 2010

My Portlets Won't Register in Liferay.... Why is this?

Yeah here's another one that will astound you with the sheer variety of possible answers out there on the web. Head over to and search the forums and watch the show.

The reason is, I suppose, because this is one of those problems that really can be caused by a number of different things and maybe a different approach really does work for different people.

The problem:

You drop a portlet .war file into your Liferay 5.2.3 hot deploy folder. (Running in an Apache Tomcat 6 server bundle.) The output console indicates that the file was copied successfully and that portlet installation will begin in a few seconds...




...and after a while those few seconds have turned into several minutes, and still no further activity from Liferay. Oh, everything else seems to work okay but you won't be able to use that portlet. It hasn't been registered.

It looks like the cause of this is somewhere in the myriad of temoporary files and caches something's making Liferay stumble. Your mission, if you choose to accept it: Find the block and eliminate it. I admit this is a somewhat shotgun-like approach but hey, it's all good for the server anyway, right?

Browse on over to [Tomcat Home Folder]/conf/Catalina/localhost/

See an xml file in there named after the portlet you're trying to deploy? Delete. (Making "pew-pew" sounds as you do it will relieve some tension here. Ignore the reactions of your co-workers. You're on a mission.)

OK now head back up to [Tomcat Home Folder]/temp/

Any folders in there? Destroy them. "pew-pew."

Now go into [Tomcat Home Folder]/webapps/

Any folders in there corresponding to any of the portlets you've been having trouble with? "pew-pew."

Now start your Liferay back up.

Once it's up, go into Control Panel and on down to Server Administration. Do some regular maintenance stuff like Clearing the cached content, reindex your serach indexes, run garbage collector.

Now try that hot deploy again.

Epilogue: This fix was only temporary. It allowed me to deploy some pre-existing portlets but my ICEfaces enabled portlet project still brought it down again. I suspect it's because I changed my build path in that portlet (and if you've been reading my blogs you know what that'll do to a server joined to Eclipse) anyway. Suddenly it can't find resources etc etc etc.

I blew away that Liferay install and started up a fresh Liferay install and hot deployed my custom portlet. It worked fine this time.

Update: 12/8/2010 If you follow the above steps and top it all off by going into the Liferay Control Panel and Reindexing the Search Indexes, you can get it to hot deploy your portlet, but you may have to go through this process each time you want to re-deploy unless you can just re-install Liferay.

Monday, October 25, 2010

It's a Layout Template Not a Portlet!!!!!

This was an interesting one so I thought I'd share.

This morning I was building some layout templates for Liferay 5.2.3 with the plugins sdk and a simple text editor. (Wordpad, if you must know. Yes, I'm in Windows these days.) I made the changes I needed, zipped it up into a .war file and dropped it into my hot deploy folder.

I opened up Liferay on my localhost to witness the majesty that was my layout template and... Nothing. It didn't appear in the list of choices.

So I re-opened the files and made sure everything was correctly formatted and that I hadn't missed anything in my configuration or code. Hot deploy again and...


So I opened up the terminal window where the Tomcat output was running and yes indeed, it had successfully imported, installed and made my portlet available for use.

Yes, I said portlet.

Now that's interesting... Just for giggles I clicked "Add Application" from the Dock and in the filter box started typing the name of my awesome layout template... And there it was.


So Liferay thinks my layout template is a portlet. I wondered... what if I clicked "add..."

It added a portlet. It added a portlet with the text "The requested resource (/3_columns_i_5-layouttpl/3_columns_i_5layouttpl/invoke) is not available" in it.

Yeah I know, right?

So I started to compare the liferay-plugin-package.xml file with that from a known (and tested) working template I downloaded from Liferay. All the same. Code in the individual files... all the same. WTH???

Now some of you, by now, may have figured out what I did wrong. For those that haven't go ahead and take a guess. I haven't really given enough information to make it blatantly obvious since I wanted to save it as a surprise but try anyway. I'll wait right here.

Back already, eh? Ok I'll tell you.

When I created my .war file I included the docroot directory in the structure. (This is what I get for trying to be fast and slick.) The proper contents of a layout template .war file is what's inside the docroot folder.

Apparently when Liferay 5.2.3 sees docroot in a .war file it thinks you're deploying a portlet and runs with it.

Oh, and for those of you who don't know the quick and dirty way to generate a .war file... Just put your stuff in a .zip file and change the extension to .war.

Just don't include docroot if it's a layout template...

Friday, October 22, 2010

ContextEventRepeater Can Serve as a 4-letter Word

I've seen a LOT of people have trouble with this one. You get the dreaded NoClassDefFoundError and it's pointing right at com.icesoft.faces.util.event.servlet.ContextEventRepeater.

There's a variety of forum posts on this monster over at but the causes of this particular error seem to be wide and varied, and even after checking all the things they tell you to check you can still wind up slamming your head against the keyboard until the spacebar is smeared with blood and hair.

I've been tooling around with Eclipse Ganymede (That's version 3.4.2 if you care) with ICEfaces 1.8.1. I got this hideous error myself today and the cause, in my case, is absolutely bizarre.

I'd been building my little app and getting some other, unrelated, strange errors when I decided that what I needed to do was to move my build output from the default /build to /WEB-INF/classes. Sounds peachy, right?

Well, wouldn't you know, that triggered the hideous error. At first I didn't think there could POSSIBLY be a connection so I did the search/read/headbang thing for about 2 hours before I decided to try to switch that output folder back.

Guess what?

That fixed the error.

Normally I try to follow up these little nuggets with an explanation of why that happened but I have absolutely no idea. I presume it has something to do with how Eclipse tells the server where the .jars are but I really am stumped. If anybody would like to E-mail me with that or post a comment on why, it would be very much appreciated.

Tuesday, October 5, 2010

Making MySQL Install - or - WHY CAN'T I FIND THE PACKAGE?!?!?!?!?!?

So you're looking to install MySQL on your Ubuntu machine because you know how much MySQL rocks or because you want to link it up with Liferay or both. (Or neither. I dunno.)

There's a plethora of advice on the web on how to do this. "Easy!" They tell you "All you have to do is use the command

sudo apt-get install mysql-server

and you're good to go!"

So you happily get on your terminal, type in that command, enter your root password and all that and...

E: Can't find package mysql-server


So you restart your machine because one guy was able to get the packages to appear in the Synaptic Package Manager after doing that and that doesn't help. So you search for it in Synaptic and that doesn't help either. The fate of the world rests in you getting MySQL installed and suddenly that wonderful apt-get feature ain't looking too hot.

Well don't start the manual installation just yet, friends.

See, the problem is that MySQL is (as of the time I write this) on version 5.1 and that's included in the package name. No, you might not see it in Synaptic either. Use this command:

sudo apt-get install mysql-server-5.1

And watch the magic happen.