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 Liferay.com 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.

No comments:

Post a Comment