Adding the tag liferay-editor for WYSIWYG editor is giving UnsupportedOpera

thumbnail
Prasad Vallabhaneni, modified 2 Years ago. New Member Posts: 13 Join Date: 5/23/14 Recent Posts

Hi,

We require a WYSIWYG editor in custom JSP and we added the below lines in the custom jsp. When this jsp is loaded it is giving java.lang.UnsupportedOperationException: Requires 3.0 opt-in and the editor does not come up.

<%@ taglib uri="http://liferay.com/tld/editor" prefix="liferay-editor" %>

<div class="alloy-editor-container">
    <liferay-editor:editor
    		contents="Default Content"
    		cssClass="my-alloy-editor"
    		editorName="alloyeditor"
    		name="myAlloyEditor"
    		placeholder="description"
    		showSource="true" 
    /> 
</div>

 

We are using Liferay DXP 7.4.13.U54 Version. Can you please help in getting the WYSIWYG editor in custom jsp. Do we need to add / update any config files

Error log:

2023-01-01 06:06:38.433 ERROR [http-nio-8080-exec-4][IncludeTag:128] Current URL /announs 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:523) ~[portal-impl.jar:?]
    at com.liferay.portlet.internal.PortletURLImpl._initMutableRenderParameters(PortletURLImpl.java:1642) ~[portal-impl.jar:?]
    at com.liferay.portlet.internal.PortletURLImpl.<init>(PortletURLImpl.java:1317) ~[portal-impl.jar:?]
    at com.liferay.portlet.internal.PortletURLImpl.<init>(PortletURLImpl.java:117) ~[portal-impl.jar:?]
    at com.liferay.portlet.internal.RenderURLImpl.<init>(RenderURLImpl.java:44) ~[portal-impl.jar:?]
    at com.liferay.portlet.internal.PortletURLFactoryImpl._create(PortletURLFactoryImpl.java:236) ~[portal-impl.jar:?]
    at com.liferay.portlet.internal.PortletURLFactoryImpl.create(PortletURLFactoryImpl.java:161) ~[portal-impl.jar:?]
    at com.liferay.portal.kernel.portlet.PortletURLFactoryUtil.create(PortletURLFactoryUtil.java:107) ~[portal-kernel.jar:?]
    at com.liferay.portal.kernel.portlet.RequestBackedPortletURLFactoryUtil$LiferayPortletResponseRequestBackedPortletURLFactory.createControlPanelPortletURL(RequestBackedPortletURLFactoryUtil.java:240) ~[portal-kernel.jar:?]
    at com.liferay.portal.kernel.portlet.RequestBackedPortletURLFactoryUtil$LiferayPortletResponseRequestBackedPortletURLFactory.createControlPanelRenderURL(RequestBackedPortletURLFactoryUtil.java:253) ~[portal-kernel.jar:?]
    at com.liferay.item.selector.web.internal.ItemSelectorImpl.getItemSelectorURL(ItemSelectorImpl.java:227) ~[?:?]
    at com.liferay.item.selector.web.internal.ItemSelectorImpl.getItemSelectorURL(ItemSelectorImpl.java:261) ~[?:?]
    at com.liferay.item.selector.editor.configuration.internal.BaseEditorConfigContributor.getItemSelectorPortletURL(BaseEditorConfigContributor.java:66) ~[?:?]
    at com.liferay.item.selector.editor.configuration.internal.ImageEditorConfigContributor.populateConfigJSONObject(ImageEditorConfigContributor.java:61) ~[?:?]
    at com.liferay.portal.editor.configuration.EditorConfigProvider.lambda$getConfigJSONObject$0(EditorConfigProvider.java:45) ~[portal-impl.jar:?]
    at com.liferay.portal.editor.configuration.BaseEditorProvider.visitEditorContributors(BaseEditorProvider.java:66) ~[portal-impl.jar:?]
    at com.liferay.portal.editor.configuration.EditorConfigProvider.getConfigJSONObject(EditorConfigProvider.java:43) ~[portal-impl.jar:?]
    at com.liferay.portal.editor.configuration.EditorConfigurationFactoryImpl.getEditorConfiguration(EditorConfigurationFactoryImpl.java:43) ~[portal-impl.jar:?]
    at com.liferay.portal.kernel.editor.configuration.EditorConfigurationFactoryUtil.getEditorConfiguration(EditorConfigurationFactoryUtil.java:33) ~[portal-kernel.jar:?]
    at com.liferay.frontend.editor.taglib.servlet.taglib.EditorTag._getData(EditorTag.java:468) ~[bundleFile:?]
 

Thanks in advance.

Thanks & Regards,

Prasad Vallabhaneni

 

thumbnail
Prasad Vallabhaneni, modified 2 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

"Requires 3.0 Opt In" typically refers to Portlet Spec 3.0. Here's how to opt in.

thumbnail
Prasad Vallabhaneni, modified 2 Years ago. New Member Posts: 13 Join Date: 5/23/14 Recent Posts

Hi Olaf,

Thank you for your response. Do we require portlet 3.0 to be enabled for WYSIWYG editor? I added theportlet version in the @component, still I am received the error and the WYSIWYG editor is not visible

"@Component(
		immediate = true,
		property = {
			"com.liferay.portlet.display-category=category.sample",
			"javax.portlet.version=3.0",
			"com.liferay.portlet.header-portlet-css=/css/main.css",
			"com.liferay.portlet.instanceable=true",
			"javax.portlet.display-name=Announcement",
			"javax.portlet.init-param.template-path=/",
			"javax.portlet.init-param.view-template="+AnnouncementsDisplayPortletKeys.VIEW_PATH,
			"javax.portlet.name=" + AnnouncementsDisplayPortletKeys.ANNOUNCEMENT,
			"javax.portlet.resource-bundle=content.Language",
			"javax.portlet.security-role-ref=power-user,user"
		},
		service = Portlet.class
	)

Thanks & Regards,

Prasad Vallabhaneni

thumbnail
Prasad Vallabhaneni, modified 2 Years ago. New Member Posts: 13 Join Date: 5/23/14 Recent Posts

Hi Olaf,

After adding the portlet 3.0 it worked with out error. Earlier looks like some cache issue. Thank you for your support.

Thanks & Regards,

Prasad Vallabhaneni

Jamie Sammons, modified 1 Year ago. New Member Posts: 3 Join Date: 11/17/23 Recent Posts

Hi Prasad,

I have the same problem with a portlet in the control panel of a 7.4.3.52 installation: no editor shown and the same error "Requires 3.0 opt-in". Well I have the same also for the discussions taglib...

How exactly did you resolve? I tried to add the "javax.portlet.version=3.0" property in the component annotation but nothing changed. I tried to recompile, redeploy, restart the server: nothing.

Olaf is there some other hidden configuration to do?

 

Thanks in advance

Marco