2
votes

I am using liferay 6.1 CE (Liferay Portal Community Edition 6.1.1 CE GA2 (Paton / Build 6101 / July 31, 2012))

When I want to embed for example navigation portlet in template through this code:

$processor.processPortlet("71_INSTANCE_xyz1")

it shows just the same code in page not any portlet!

After searching, I understand that there is a bug in TemplateProcessor class in portal-impl/src/com/liferay/portlet/layoutconfiguration/util/velocity/TemplateProcessor.java file

TemplateProcessor.processPortlet() ignores supplied portletId.

Can i solve this problem by hook or extension?

If no how can solve problem?

When embedding portlet in template I receive the following error in log:

09:23:22,898 ERROR [http-bio-8080-exec-2][LiferayMethodExceptionEventHandler:33] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.model.PortletConstants.getRootPortletId(PortletConstants.java:85)
at com.liferay.portal.service.impl.PortletLocalServiceImpl.getPortletById(PortletLocalServiceImpl.java:403)
at sun.reflect.GeneratedMethodAccessor254.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:122)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
at $Proxy65.getPortletById(Unknown Source)
at com.liferay.portal.service.PortletLocalServiceUtil.getPortletById(PortletLocalServiceUtil.java:353)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:115)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:203)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletImpl.processPortlet(RuntimePortletImpl.java:190)
at com.liferay.portlet.layoutconfiguration.util.RuntimePortletUtil.processPortlet(RuntimePortletUtil.java:87)
1
If you need to fix bug in the TemplateProcessor class, you have to use ext plugin, because the mentioned class is in the portal-impl.milos.zikmund
Can you specify what Template are you embedding the portlet in? Is it the portal-normal.vm in theme or is this a web-content template you are talking about.Prakash K
My problem is about web-content templateuser3237100

1 Answers

1
votes

The following code works for me in both Theme (.vm file) and LayoutTemplate (.tpl file)

$theme.runtime("my_portlet_WAR_myportlet")