Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Exception - Liferay Portlet3 Requires 3.0 opt-in
Hi everyone.I'm trying to enable portlet 3.0 in my app, using Liferay 7.2 CE.
I've already configure my Portlet class like this
However I still getting the following exception:
Could anyone help me, please?
ThanksFilipe Santana
I've already configure my Portlet class like this
@Component(
immediate = true,
property = {
"com.liferay.portlet.display-category=category.hidden",
"com.liferay.portlet.scopeable=true",
"javax.portlet.display-name=Guestbooks",
"javax.portlet.expiration-cache=0",
"javax.portlet.init-param.portlet-title-based-navigation=true",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=/guestbook_admin/view.jsp",
"javax.portlet.name=" + GuestbookPortletKeys.GUESTBOOK_ADMIN,
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=administrator",
"javax.portlet.supports.mime-type=text/html",
"com.liferay.portlet.add-default-resource=true",
"javax.portlet.version=3.0"
},
service = javax.portlet.Portlet.class
)
However I still getting the following exception:
2019-12-03 15:23:09.182 ERROR [http-nio-8080-exec-4][IncludeTag:128] Current URL /web/guest/home/-/asset_publisher/P3UE1H5OERI4/guestbook/id/33615?_com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet_INSTANCE_P3UE1H5OERI4_redirect=http%3A%2F%2Flocalhost%3A8080%2Fweb%2Fguest%2Fhome%3Fp_p_id%3Dcom_liferay_asset_publisher_web_portlet_AssetPublisherPortlet_INSTANCE_P3UE1H5OERI4%26p_p_lifecycle%3D0%26p_p_state%3Dnormal%26p_p_mode%3Dview%26_com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet_INSTANCE_P3UE1H5OERI4_cur%3D0%26p_r_p_resetCur%3Dfalse%26_com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet_INSTANCE_P3UE1H5OERI4_assetEntryId%3D33615 generates exception: java.lang.UnsupportedOperationException: Requires 3.0 opt-in
java.lang.UnsupportedOperationException: Requires 3.0 opt-in
at com.liferay.portlet.internal.PortletRequestImpl.getRenderParameters(PortletRequestImpl.java:522)
at com.liferay.portlet.internal.PortletURLImpl._initMutableRenderParameters(PortletURLImpl.java:1607)
at com.liferay.portlet.internal.PortletURLImpl.<init>(PortletURLImpl.java:1280)
at com.liferay.portlet.internal.PortletURLImpl.<init>(PortletURLImpl.java:119)
at com.liferay.portlet.internal.RenderURLImpl.<init>(RenderURLImpl.java:43)
at com.liferay.portlet.internal.PortletURLFactoryImpl._create(PortletURLFactoryImpl.java:236)
at com.liferay.portlet.internal.PortletURLFactoryImpl._create(PortletURLFactoryImpl.java:248)
at com.liferay.portlet.internal.PortletURLFactoryImpl.create(PortletURLFactoryImpl.java:173)
at com.liferay.portal.kernel.portlet.PortletURLFactoryUtil.create(PortletURLFactoryUtil.java:115)
at com.liferay.docs.guestbook.web.internal.asset.GuestbookAssetRenderer.getURLViewInContext(GuestbookAssetRenderer.java:149)
at org.apache.jsp.view_005fasset_005fentry_005ffull_005fcontent_jsp._jspService(view_005fasset_005fentry_005ffull_005fcontent_jsp:348)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at com.liferay.portal.osgi.web.servlet.jsp.compiler.internal.JspServlet.service(JspServlet.java:369)
at com.liferay.portal.osgi.web.servlet.jsp.compiler.internal.JspServlet.service(JspServlet.java:381)
at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153)
</init></init></init>
Could anyone help me, please?
ThanksFilipe Santana
Hi Filipe,
It looks like you may need to set an addtional property to enable portlet 3.0: https://portal.liferay.dev/docs/7-1/reference/-/knowledge_base/r/breaking-changes#upgrade-considerations
It looks like you may need to set an addtional property to enable portlet 3.0: https://portal.liferay.dev/docs/7-1/reference/-/knowledge_base/r/breaking-changes#upgrade-considerations
Hello Jamie,I could not found any other property to set.Do you know which one is missing from my configuration?
Thank you
Thank you
Hi Filipe,
My apologies I missed the fact that you already had javax.portlet.version=3.0 set in the app. What's strange is it appears to be the Asset Publisher that is displaying the error.
My apologies I missed the fact that you already had javax.portlet.version=3.0 set in the app. What's strange is it appears to be the Asset Publisher that is displaying the error.
Hi Jamie. That's fine. Same impression here... Thanks.
We have the same issue, it looks like the Request object that is passed to the AssetRenderer is not 3.0.
None of the Liferay portlets have "javax.portlet.version=3.0" set, so no help in using the Liferay code as an example.The issues happens typically when using PortletURLFactoryUtil because the PortletURLImpl.java code checks the portlet(ID) version and decides that _portletSpecMajorVersion == 3. So it sets up the PortletURLImpl as a 3.0 version. BUT the request that gets passed around is _portletSpecMajorVersion < 3 (because the request is from on of the Liferay portlets) so this throws an exception down the line.
How did you fix the problem? Not using "javax.portlet.version=3.0" at all?
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™