Trying to include component on page and getting error | Community
Skip to main content
Level 6
May 5, 2022 8:35 AM UTC
Solved

Trying to include component on page and getting error

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.
arunpatidar
arunpatidarAccepted solution
New Participant
May 5, 2022 4:15 PM UTC

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

5 replies

arunpatidar
arunpatidarAccepted solution
New Participant
May 5, 2022 4:15 PM UTC

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

 

 

Translate
Arun Patidar
Anmol_Bhardwaj
New Participant
May 5, 2022 1:48 PM UTC

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.

Translate
DEBAL_DAS
New Participant
May 5, 2022 10:09 AM UTC

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

Translate
Ronnie09Author
Level 6
May 5, 2022 10:14 AM UTC

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

Translate
DEBAL_DAS
New Participant
May 5, 2022 10:21 AM UTC

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.

Translate