Trying to include component on page and getting error | Community
Skip to main content
May 5, 2022
Solved

Trying to include component on page and getting error

  • May 5, 2022
  • 3 replies
  • 1394 views

Hi,

 

I am trying to include component on page via sightly code using

<div data-sly-resource="${'btn' @ resourceType='world/components/content/max-button'}"> </div>

 

I can see the parsys of the max-button component but unable to author it. In logs I am getting the below error. Need help

 

java.lang.NullPointerException: null at com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl.hasStructureTemplate(ContentPolicyManagerImpl.java:223) [com.day.cq.wcm.cq-wcm-core:5.12.172] at com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl.getPolicyMapping(ContentPolicyManagerImpl.java:241) [com.day.cq.wcm.cq-wcm-core:5.12.172] at com.day.cq.wcm.core.impl.policies.ContentPolicyManagerImpl.getPolicy(ContentPolicyManagerImpl.java:104) [com.day.cq.wcm.cq-wcm-core:5.12.172] at com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbeddableOptionsDataSourceServlet.getEmbeddableOptions(EmbeddableOptionsDataSourceServlet.java:73) [com.adobe.cq.core.wcm.components.core:2.17.0] at com.adobe.cq.wcm.core.components.internal.servlets.embed.EmbeddableOptionsDataSourceServlet.doGet(EmbeddableOptionsDataSourceServlet.java:62) [com.adobe.cq.core.wcm.components.core:2.17.0] at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:266) [org.apache.sling.api:2.22.0] at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:342) [org.apache.sling.api:2.22.0] at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:374) [org.apache.sling.api:2.22.0] at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:570) [org.apache.sling.engine:2.7.4] at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) [org.apache.sling.engine:2.7.4] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:82) [org.apache.sling.engine:2.7.4] at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119) [com.day.cq.wcm.cq-wcm-core:5.12.172] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4] at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:156) [com.day.cq.wcm.cq-wcm-core:5.12.172] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.7.4] at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [org.apache.sling.engine:2.7.4] .....

.....

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi,

Can you check core embed component if you are using it?

That component required policy to set for the template.

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/components/embed.html?lang=en

 

 

3 replies

DEBAL_DAS
May 5, 2022

Do you have any sling model for max-button component? Could you please brief us about htl/sightly part of max-button component.

Ronnie09Author
May 5, 2022

Yes we have sling model for max-button. 
Max-button have design dialog -  With allowed embeddedable.

Max-button have embeddable node- youtube, wimeo and more


Sightly code have links url, label, button type, embeddeables

DEBAL_DAS
May 5, 2022

From the error statement it looks like due to absence of embeddedable node you are getting null pointer exception for the first time. 

 

Are you reading embeddedable as object in sling model? If yes, have you done null check.

Anmol_Bhardwaj
Community Advisor
Community Advisor
May 5, 2022

From the logs, I think the problem is with the template policy.

I think the component you are trying to include is not allowed within the template policies. Try adding that component to the list of allowed components for the template.

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
May 5, 2022

Hi,

Can you check core embed component if you are using it?

That component required policy to set for the template.

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/components/embed.html?lang=en

 

 

Arun Patidar