Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!
SOLVED

Is it possible to include embed component in html?

Avatar

Level 1

I'm trying to add embed component by html by using this tag:

<sly data-sly-resource="${'embed' @resourceType='/apps/site/components/embed'}" />

 

But when I try to edit the dialog I get this error:

com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbeddableOptionsDataSourceServlet

Exception:

java.lang.NullPointerException
	at com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl.hasStructureTemplate(ContentPolicyManagerImpl.java:223)
	at com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl.getPolicyMapping(ContentPolicyManagerImpl.java:241)
	at com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl.getPolicy(ContentPolicyManagerImpl.java:104)
	at com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbeddableOptionsDataSourceServlet.getEmbeddableOptions(EmbeddableOptionsDataSourceServlet.java:73)
	at com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbeddableOptionsDataSourceServlet.doGet(EmbeddableOptionsDataSourceServlet.java:62)
	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:266)
	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:342)
	at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:374)
	at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:574)
	at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:88)
	at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78)
	at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:156)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78)
	at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:165)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78)
	at com.day.cq.wcm.core.impl.page.PageLockFilter.doFilter(PageLockFilter.java:91)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78)
	at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:94)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78)
	at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217)
	at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78)
	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:283)
	at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:323)
	at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:211)
	at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:104)
	at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:516)
	at com.adobe.granite.ui.components.impl.SlingIncludeObjectFactory.get(SlingIncludeObjectFactory.java:118)
	at com.adobe.granite.ui.components.impl.BaseComponentHelper.asDataSource(BaseComponentHelper.java:486)
	at com.adobe.granite.ui.components.impl.BaseComponentHelper.getItemDataSource(BaseComponentHelper.java:431)
	at com.adobe.granite.ui.components.impl.BaseComponentHelper.getItemDataSource(BaseComponentHelper.java:396)
	at com.adobe.granite.ui.components.ComponentHelper.getItemDataSource(ComponentHelper.java:363)
	at org.apache.jsp.libs.granite.ui.components.coral.foundation.form.fieldset.fieldset_jsp._jspService(fieldset_jsp.java:163)
	at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) 

If I add the same component manually it works perfectly. 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @danielchido ,

The issue could be with missing node for embed component in the content , that you need to create your component for embed using cq:template node under main component you are trying to add.

 

Screen Shot 2022-06-16 at 4.19.17 PM.png

Tried embedding with cq:template to helloworld component and it works as expected!

Screen Shot 2022-06-16 at 4.22.09 PM.png

Regards,

Santosh

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @danielchido ,

The issue could be with missing node for embed component in the content , that you need to create your component for embed using cq:template node under main component you are trying to add.

 

Screen Shot 2022-06-16 at 4.19.17 PM.png

Tried embedding with cq:template to helloworld component and it works as expected!

Screen Shot 2022-06-16 at 4.22.09 PM.png

Regards,

Santosh

Avatar

Level 1

Thank you, this solved my problem.