Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Trying to include component on page and getting error

Avatar

Level 6

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]

.....

.....

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.ht...

 

 

5 Replies

Avatar

Community Advisor

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

Avatar

Level 6

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

Avatar

Community Advisor

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.

Avatar

Community Advisor

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.

Avatar

Correct answer by
Community Advisor

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.ht...