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
BedrockMission!

Learn More

View all

Sign in to view all badges

Getting error while importing WCMUsePojo in sightly component.

Avatar

Avatar
Validate 10
Level 3
gargsahil099
Level 3

Likes

13 likes

Total Posts

57 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 10
Level 3
gargsahil099
Level 3

Likes

13 likes

Total Posts

57 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
gargsahil099
Level 3

14-11-2017

hi All,

I am facing the issue while using the java in sightly i am extending my java class from WCMUsePojo;

Below is hierarchy.

1_doubt.PNG

TopNav.java

import com.day.cq.sightly.WCMUsePojo;

and using this java class in sightly component using the below code

site-topnav.html

<div data-sly-use.topnav="TopNav">

    <a href="${topnav.root.path}.html">we.<strong>train</strong></a>

    <li data-sly-repeat="${topnav.items}">

    <a href="${item.path}.html">${item.title}</a>

    </li>

    </div>

But i am getting the error on browser while accessing this component

org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.sightly.impl.compiler.CompilerException: org.apache.sling.scripting.sightly.impl.compiler.CompilerException: Compilation errors in apps/training/components/site_topnav/TopNav.java:

Line 7, column 177 : Only a type can be imported. com.day.cq.sightly.WCMUsePojo resolves to a package

Can someone please suggest me how to resolve this.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 50
Level 6
Techaspect_Solu
Level 6

Likes

63 likes

Total Posts

150 posts

Correct Reply

79 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Level 6
Techaspect_Solu
Level 6

Likes

63 likes

Total Posts

150 posts

Correct Reply

79 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Techaspect_Solu
Level 6

16-11-2017

Hi,

We could see from your code snippet that you had used "import com.day.cq.sightly.WCMUsePojo;"

Sightly APIs were introduced from 6.x onwards. Although there is feature pack of sightly available in 5.6.1, but that is just to see sightly preview and won't support sightly APIs completely. This is the reason behind the error that you're seeing.

We had tried using "import com.adobe.cq.sightly.WCMUsePojo;" and your code works fine for us in AEM 6.x.

NOTE:

1. The field WCMUsePojo.currentPage won't be visible.

Hence you should be using getCurrentPage() instead of currentPage in your code.

2. When you've hyphen in your component name, then you should be mentioning the package name as below:

package apps.training.components.site_topnav;

i.e. hyphen must be replaced with underscore in your package name to get your code working.

Sample java code:

package apps.training.components.site_topnav;

import java.util.*;

import com.day.cq.wcm.api.*;

import com.adobe.cq.sightly.WCMUsePojo;

public class TopNav extends WCMUsePojo {

private List<Page> items=new ArrayList<Page>();

private Page rootPage;

@Override  

   public void activate() throws Exception{

   rootPage=getCurrentPage().getAbsoluteParent(2);

  

        if(rootPage==null)

        {

            rootPage=getCurrentPage();

        }

        Iterator<Page> childPages=rootPage.listChildren(new PageFilter(getRequest()));

        while(childPages.hasNext())

        {

            items.add(childPages.next());

        }

     }

       

    public List<Page> getItems()

    {

        return items;

    }

    public Page getPage()

    {

        return rootPage;

    }

}

}

Sample sightly code:

<div data-sly-use.topnav="${'TopNav'}">

    <a href="${topnav.page.path}.html">we.<strong>train</strong></a>

<ul>

    <li data-sly-repeat="${topnav.items}">

    <a href="${item.path}.html">${item.name}</a><br/>

    </li>

    </ul>  

</div>

We hope this helps!

Regards,

TechAspect Solutions

Answers (4)

Answers (4)

Avatar

Avatar
Validate 1
Level 1
preetip89560241
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
preetip89560241
Level 1

Like

1 like

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
preetip89560241
Level 1

10-08-2018

Hi edubey,

I am facing the similar issue in fetching the WCMUse Pojo Java class in sightly Page.

Getting the error as below:

In the HTML File

<sly data-sly-use.inlineVidjava="com.sap.common.components.inlineVideo.InlineVideoHtl">

Error during include of component '/apps/sap1dx/components/foundation/inlineVideo2Htl'

Error Message:

org.apache.sling.scripting.sightly.SightlyException: Identifier com.sap.common.components.inlineVideo.InlineVideoHtl cannot be correctly instantiated by the Use API

Processing Info:

Page=/content/sep1dx/header-nk/en_us/hometest
Resource Path=/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl
Cell=inlineVideo2Htl
Cell Search Path=home|basepage|page/DHSecCompPar|parsys/CQSectionComp|parbase/DHSubSecCompPar|parsys/inlineVideo2Htl|parbase
Component Path=/apps/sap1dx/components/foundation/inlineVideo2Htl

Sling Request Progress:

      0 TIMER_START{Request Processing} 0 COMMENT timer_end format is {<elapsed microseconds>,<timer name>} <optional message> 4 LOG Method=GET, PathInfo=null 7 TIMER_START{handleSecurity} 3874 TIMER_END{3865,handleSecurity} authenticator org.apache.sling.auth.core.impl.SlingAuthenticator@47b88782 returns true 4011 TIMER_START{ResourceResolution} 4099 TIMER_END{87,ResourceResolution} URI=/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl.html resolves to Resource=JcrNodeResource, type=sap1dx/components/foundation/inlineVideo2Htl, superType=null, path=/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl 4103 LOG Resource Path Info: SlingRequestPathInfo: path='/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl', selectorString='null', extension='html', suffix='null' 4103 TIMER_START{ServletResolution} 4106 TIMER_START{resolveServlet(/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl)} 4115 TIMER_END{8,resolveServlet(/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl)} Using servlet /apps/sap1dx/components/foundation/inlineVideo2Htl/inlineVideo2Htl.html 4116 TIMER_END{12,ServletResolution} URI=/content/sep1dx/header-nk/en_us/hometest/jcr:content/DHSecCompPar/cqsectioncomp_2136949291/DHSubSecCompPar/inlinevideo2htl.html handled by Servlet=/apps/sap1dx/components/foundation/inlineVideo2Htl/inlineVideo2Htl.html 4118 LOG Applying Requestfilters 4120 LOG Calling filter: com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl 4125 LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter 4127 LOG Calling filter: com.adobe.granite.httpcache.impl.InnerCacheFilter 4130 LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter 4132 LOG Calling filter: com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker 4134 LOG Calling filter: com.adobe.cq.history.impl.HistoryRequestFilter 4347 LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter 4354 LOG Calling filter: com.adobe.cq.wcm.core.components.internal.servlets.CoreFormHandlingServlet 4356 LOG Calling filter: com.adobe.granite.optout.impl.OptOutFilter 4359 LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet 4361 LOG Calling filter: com.adobe.cq.social.commons.cors.CORSAuthenticationFilter 4363 LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter 4365 LOG Calling filter: com.adobe.acs.commons.rewriter.impl.VersionedClientlibsTransformerFactory$BadMd5VersionedClientLibsFilter 4375 LOG Calling filter: com.cognifide.slice.core.internal.filter.ContextRequstFilter 4387 LOG Calling filter: com.htl.community.coral.core.filters.LoggingFilter 4389 LOG Calling filter: com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter 4391 LOG Calling filter: com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl 4611 LOG Calling filter: org.apache.sling.security.impl.ContentDispositionFilter 4613 LOG Calling filter: com.adobe.granite.csrf.impl.CSRFFilter 4616 LOG Calling filter: com.adobe.granite.rest.assets.impl.AssetContentDispositionFilter 4618 LOG Calling filter: com.adobe.granite.requests.logging.impl.RequestLoggerImpl 4623 LOG Calling filter: com.day.cq.wcm.core.impl.warp.TimeWarpFilter 4625 LOG Calling filter: com.adobe.granite.rest.impl.servlet.ApiResourceFilter 4628 LOG Calling filter: com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet 4631 LOG Calling filter: com.day.cq.dam.core.impl.servlet.ActivityRecordHandler 4636 LOG Calling filter: com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler 4639 LOG Applying Componentfilters 4640 LOG Calling filter: com.day.cq.personalization.impl.TargetComponentFilter 4642 LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter 5508 LOG Found processor for post processing ProcessorConfiguration: {contentTypes=[text/html], order=-1, active=true, valid=true, processErrorResponse=true, pipeline=(generator=Config(type=htmlparser, config={}), transformers=(Config(type=mobile, config=JcrPropertyMap [node=Node[NodeDelegate{tree=/libs/cq/config/rewriter/default/transformer-mobile: { jcr:primaryType = nt:unstructured, component-optional = true}}], values={jcr:primaryType=nt:unstructured, component-optional=true}]), Config(type=mobiledebug, config=JcrPropertyMap [node=Node[NodeDelegate{tree=/libs/cq/config/rewriter/default/transformer-mobiledebug: { jcr:primaryType = nt:unstructured, component-optional = true}}], values={jcr:primaryType=nt:unstructured, component-optional=true}]), Config(type=contentsync, config=JcrPropertyMap [node=Node[NodeDelegate{tree=/libs/cq/config/rewriter/default/transformer-contentsync: { jcr:primaryType = nt:unstructured, component-optional = true}}], values={jcr:primaryType=nt:unstructured, component-optional=true}]), Config(type=versioned-clientlibs, config={}), serializer=Config(type=htmlwriter, config={}))} 5600 LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter 5608 TIMER_START{/apps/sap1dx/components/foundation/inlineVideo2Htl/inlineVideo2Htl.html#0} 6197 LOG SCRIPT ERROR: Identifier com.sap.common.components.inlineVideo.InlineVideoHtl cannot be correctly instantiated by the Use API 6201 TIMER_END{592,/apps/sap1dx/components/foundation/inlineVideo2Htl/inlineVideo2Htl.html#0} 7208 TIMER_END{7207,Request Processing} Dumping SlingRequestProgressTracker Entries 

Full Exception:

org.apache.sling.scripting.sightly.SightlyException: Identifier com.sap.common.components.inlineVideo.InlineVideoHtl cannot be correctly instantiated by the Use API at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:77) at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:75) at org.apache.sling.scripting.sightly.apps.sap1dx.components.foundation.inlineVideo2Htl.inlineVideo2Htl_html.render(inlineVideo2Htl_html.java:39) at org.apache.sling.scripting.sightly.java.compiler.RenderUnit.render(RenderUnit.java:48) at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiledScript.java:61) at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386) at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552) at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77) at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:192) at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:159) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:278) at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:373) at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:190) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282) at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChain.java:49) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77) at com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler.doFilter(AdhocAssetShareAuthHandler.java:436) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.dam.core.impl.servlet.ActivityRecordHandler.doFilter(ActivityRecordHandler.java:154) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73) at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostServlet.java:114) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.granite.rest.impl.servlet.ApiResourceFilter.doFilter(ApiResourceFilter.java:70) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:109) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73) at com.adobe.granite.requests.logging.impl.RequestLoggerImpl.doFilter(RequestLoggerImpl.java:126) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.granite.rest.assets.impl.AssetContentDispositionFilter.doFilter(AssetContentDispositionFilter.java:96) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.security.impl.ContentDispositionFilter.doFilter(ContentDispositionFilter.java:180) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.java:367) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:248) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.htl.community.coral.core.filters.LoggingFilter.doFilter(LoggingFilter.java:50) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.cognifide.slice.core.internal.filter.ContextRequstFilter.doFilter(ContextRequstFilter.java:84) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.acs.commons.rewriter.impl.VersionedClientlibsTransformerFactory$BadMd5VersionedClientLibsFilter.doFilter(VersionedClientlibsTransformerFactory.java:422) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgressTrackerLogFilter.java:107) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.cq.social.commons.cors.CORSAuthenticationFilter.doFilter(CORSAuthenticationFilter.java:91) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServletHelper.java:221) at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.java:138) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:76) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServletHelper.java:221) at com.adobe.cq.wcm.core.components.internal.servlets.CoreFormHandlingServlet.doFilter(CoreFormHandlingServlet.java:131) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.cq.history.impl.HistoryRequestFilter.doFilter(HistoryRequestFilter.java:122) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker.doFilter(CampaignCopyTracker.java:100) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:81) at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:60) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:138) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:73) at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(ResourceResolverHelperImpl.java:83) at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68) at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:151) at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:219) at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79) at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308) at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74) at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:96) at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74) at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:295) at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74) at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:138) at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74) at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116) at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74) at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:72) at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74) at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:128) at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at com.adobe.cq.sightly.WCMUsePojo.get(WCMUsePojo.java:108) at com.adobe.cq.sightly.WCMUsePojo.getProperties(WCMUsePojo.java:172) at com.sap.common.components.inlineVideo.InlineVideoHtl.<init>(InlineVideoHtl.java:41) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider.provide(JavaUseProvider.java:120) at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:72) ... 122 more

Avatar

Avatar
Validate 10
Level 3
gargsahil099
Level 3

Likes

13 likes

Total Posts

57 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 10
Level 3
gargsahil099
Level 3

Likes

13 likes

Total Posts

57 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
gargsahil099
Level 3

19-11-2017

Thanks for your explanation!!. It helped me a lot.

Avatar

Avatar
Validate 10
Level 3
gargsahil099
Level 3

Likes

13 likes

Total Posts

57 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 10
Level 3
gargsahil099
Level 3

Likes

13 likes

Total Posts

57 posts

Correct Reply

4 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
gargsahil099
Level 3

14-11-2017

HI Dubey

Thanks for responding

Please find the below code snipplet.

//package apps.training.components.site-topnav

import java.util.*;

import java.util.Iterator;

import com.day.cq.wcm.api.*;

import com.day.cq.sightly.WCMUsePojo;

public class TopNav extends WCMUsePojo

{

private List<Page> items=new ArrayList<Page>();

private Page rootPage;

@Override   

    public void activate() throws Exception{

   rootPage=currentPage.getAbsoluteParent(2);

        if(rootPage==null)

        {

            rootPage=getCurrentPage();

        }

        Iterator<Page>  childPages=rootPage.listChildren(new PageFilter(getRequest()));

        while(childPages.hasNext())

        {

items.add(childPages.next());

        }

    }

    public List<Page> getItems()

    {

return items;

    }

    public Page getPage()

    {

return rootPage;

    }

}

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

273 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

273 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

14-11-2017

Can you share the code snippet from TopNav.java ?