Tuesday, October 11, 2011

In a Portlet: Where's my FacesContextFactory?

Getting this error?

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory

Liferay 6
JSF 2.0

Was it working just fine a little while ago?
Well when I got this one all I'd changed was to set the "instanceable" setting in the liferay-portlet.xml file from "true" to "false."  Then I started getting this error.

Restarting the portal won't fix this.
Re-installing the portlet won't fix it either.

See, if your portlet was previously instanceable and now it isn't, but you left the portlet on the page when you re-installed, then it blows up all sorts of interesting things.  When you make a change like that you have to remove the portlet from the page and drop it back on again.

So to fix this, just remove it from the page, place it back on, and presto!  All should be well.