Details
Description
The portal fails the deploy-undeploy-redeploy sequence for any simple portlet. To reproduce:
1. Use any portlet (one that extends GenericPortlet) packaged in a war
2. Deploy the portlet
3. Add the portlet to a Liferay page
4. Query the page with the browser - the portlet should work ok
5. Undeploy the portlet
6. Query the page with browser - the protlet should write - Portlet is temporarily unavailable
7. re-deploy the porltet
8. Query the page with browser - the portlet sould write - Portlet is temporarily unavailable
Depending on the environment sometimes the whole page fails and a Java error page is rendered instead.
The cause is that after undeploy of the portlet the com.liferay.portal.service.impl.PortletLocalServiceImpl class keeps a reference to the original class. This should be patched in the portlet undeploy process.
My solution for the bug:
1. com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeUndeploy(HotDeployEvent event) add a line:
Iterator itr = portlets.iterator();
while (itr.hasNext())
{ Portlet portlet = (Portlet)itr.next(); ... // Insert this line: PortletLocalServiceUtil.removePortlet(portlet); }2. Add the referenced method to the PortletLocalServiceUtil class where we delegate the cal to the implementation:
public static void removePortlet(Portlet portlet)
3. In the implementation class (com.liferay.portal.service.impl.PortletLocalServiceImpl):
public void removePortlet(Portlet portlet)
Where clearCaches() is the two lines that are present in the initEAR and initWAR methods:
private void clearCaches()
These patches have solved the undeploy-deploy problem for me