Dear All,
In my current project , we are converting static templates to editable templates in AEM 6.5 SP1 by using modernization_tools
Before converting we are creating editable templates. So I have created editable template and created the policy. Now I want to use the existing component Top Navigation.
While I am using the existing component in my editable template then I am getting below error.
*ERROR* [0:0:0:0:0:0:0:1 [1572429882269] GET /conf/sunita/settings/wcm/templates/thank-you/structure/jcr:content/root/topnav1.html HTTP/1.1] com.day.cq.wcm.core.impl.WCMDebugFilter Exception: Cannot get DefaultSlingScript: Identifier com.sunita.global.core.models.SiteUrlsModel cannot be correctly instantiated by the Use API
org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Identifier com.sunita.global.core.models.SiteUrlsModel cannot be correctly instantiated by the Use API
Can anybody please help me on this?
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
Dear All,
The issue is fixed now. I was getting null pointer exception in my TopNav JAVA class. So changed like below and it is working fine.
if (currentPage != null) {
Page homePage = currentPage.getAbsoluteParent(SiteConstants.HOMEPAGE_PARENT_DEPTH);
if (homePage != null)
{
locale = homePage.getLanguage(true);
}
}
}
Views
Replies
Total Likes
Did you try using the same component on static template?
Its nothing to do with static or dynamic templates its issue with ir sling model class its not available.
check these models through system console.
Views
Replies
Total Likes
Dear All and Ka,
By going through some of the AEM forum posts above issue fixed after I changed from @Model(adaptables = SlingHttpServletRequest.class) to @Model(adaptables = Resource.class) .
But now I am getting the below error.
*ERROR* [0:0:0:0:0:0:0:1 [1573028316905] GET /conf/sunita/settings/wcm/templates/thankyou3/structure/jcr:content/root/topnav.html HTTP/1.1] com.day.cq.wcm.core.impl.WCMDebugFilter Error during include of SlingRequestPathInfo: path='/conf/sunita/settings/wcm/templates/thankyou3/structure/jcr:content/root/topnav', selectorString='null', extension='html', suffix='null'
org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Compilation errors in org/apache/sling/scripting/sightly/apps/sunita/components/content/topNav/topNav_html.java:
Line 144, column 9577 : com.sunita.global.core.models.utils.NestedMultifieldHelper cannot be resolved to a type
Line 293, column 21059 : com.sunita.global.core.models.utils.NestedMultifieldHelper cannot be resolved to a type
Line 304, column 22009 : com.sunita.global.core.models.utils.NestedMultifieldHelper cannot be resolved to a type
Line 371, column 26781 : com.sunita.global.core.models.utils.NestedMultifieldHelper cannot be resolved to a type
My topnav.html is as below.
topNav.html is below
<div id="header-menu">
<div data-sly-use.site="com.sunita.global.core.models.SiteUrlsModel" data-sly-use.topNavModel="com.sunita.global.core.models.TopNavModel">
<nav class="navMenu navbar brandLogoBackground slideNav clearfix" id="slide-nav">
<div class="maxContainer">
<div class="navbar-header pull-left">
<div class="navbarToggleContainer">
<a class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</div><!-- navbarToggleContainer -->
<a class="navbar-brand" href="${inheritedPageProperties['logoPath'] || site.homePageUrl @ extension = 'html'}">
<img id="img-nav-logo" src="${inheritedPageProperties['logoImage'] || '/apps/sunita/clientlibs/clientlib-site/resources/logo-header.png'}" alt="${inheritedPageProperties['logoAltText'] || 'Best Western' @ i18n}" style="background-color:${inheritedPageProperties['logoBgcolor'] @ context='styleString' || 'none'}">
</a>
</div><!-- navbar-header -->
<!-- Login Component Start -->
<div class="navbar-header pull-right navbarLoginContainer">
<div class="navbarLogin" id="bw-login-button">
<!-- Display for non-logged in users -->
<a href="#" class="loginLink" role="button" data-toggle="modal" data-target="#login-modal">${properties.loginLinkLabel || 'Login' @ i18n}</a>
<!-- Display for logged in users-->
<a href="#" class="dropdown-toggle accountNavLink" role="button" data-toggle="collapse" data-target="">
<div class="loginUserIcon"></div>
<div class="loginCollapsedArrow"></div>
<div class="loggedInBtnTextContainer">
<div id="logged-in-user-name" class="loggedInUserName"></div>
<div class="">${'My Account' @ i18n}<span class="arrow"></span></div>
</div>
</a>
</div>
<sly data-sly-include="accountNavigation.html"></sly>
</div>
<!-- Login Component End -->
<!-- /.navbar-header -->
<div class="slideMenu" id="slide-menu">
<ul class="nav navbar-nav list-unstyled navStatic" id="menu-header">
<li id="menu-header-text">${'Menu' @ i18n}</li>
<li class="menuHeaderDivider"></li>
</ul>
<ul class="nav navbar-nav list-unstyled navStatic" id="menu-options">
<div data-sly-unwrap data-sly-use.multiPropertyHelper="${'com.sunita.global.core.models.utils.NestedMultifieldHelper' @ multifieldNodeName='links', inheritProperty=true}">
<span data-sly-unwrap data-sly-list.item="${multiPropertyHelper.itemsList}">
<li>
<a href="${item.link @ extension='html'}">${item.title @ i18n}</a>
</li>
</span>
<sly data-sly-test="${inheritedPageProperties['worldsCheck'] != 'true'}">
<sly data-sly-resource="${'checkReservations' @ resourceType='sunita/components/content/checkReservations'}"></sly>
</sly>
</div>
</ul>
<ul class="nav navbar-nav navLanguage list-unstyled list-unstyled" id="nav-language">
<li class="navLanguageDropdown navStatic slideDropdownContainer">
<a href="#" id="language-mover" class="dropdown-toggle slideMover" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
${site.languageDisplay @ i18n}<span class="arrow"></span>
</a>
<div class="languageFormContainer slideContainer dropdown-menu pull-right" id="language-form-container" role="menu">
<div id="language-menu-return" class="slideReturn" tabindex="0">
<span id="language-menu-return-arrow" class="slideReturnArrow"></span>
<span id="language-menu-return-text" class="slideReturnText">${'Menu' @ i18n}</span>
</div>
<form class="form slideContent bwForm" id="language-form">
<fieldset class="form-group">
<div id="language-container">
<label class="control-label" for="language-dropdown">${properties.languageLabel || 'Language' @ i18n}</label>
<select class="form-control" id="language-dropdown">
<sly data-sly-list.langBean="${topNavModel.availableLanguages}">
<option value="${langBean.localeString}">${langBean.displayLabel || langBean.localeDisplayLanguage @ i18n}</option>
</sly>
<sly data-sly-use.multiPropertyHelper="${'com.sunita.global.core.models.utils.NestedMultifieldHelper' @ multifieldNodeName ='languages', inheritProperty=true, componentNodeName='topNav'}">
<sly data-sly-test="${multiPropertyHelper.itemsList}"><option disabled>──────────</option></sly>
</sly>
<sly data-sly-test.sorted ="${properties.sortLanguagesFlag}" data-sly-use.multiPropertyHelper="${'com.sunita.global.core.models.utils.NestedMultifieldHelper' @ multifieldNodeName ='languages', inheritProperty=true, componentNodeName='topNav', sortByKey = 'title'}">
<sly data-sly-list.item="${multiPropertyHelper.itemsList}">
<option value="${item.link}">${item.title @ i18n}</option>
</sly>
</sly>
<sly data-sly-test = "${!sorted}" data-sly-use.multiPropertyHelper="${'com.sunita.global.core.models.utils.NestedMultifieldHelper' @ multifieldNodeName ='languages', inheritProperty=true, componentNodeName='topNav'}">
<sly data-sly-list.item="${multiPropertyHelper.itemsList}">
<option value="${item.link}">${item.title @ i18n}</option>
</sly>
</sly>
</select>
</div>
<div class="languageFormButtonContainer slideButtonContainer" id="language-form-button">
<button type="button" id="btn-language-submit" class="btn ${inheritedPageProperties.worldsCheck == 'true' ? 'cmBtn cmBtnPrimary' : 'btn-primary' @ context='attribute'}" onclick="sunita.LanguageDropdown.switchLanguage()">${properties.switchBtnLabel || 'Switch' @ i18n}</button>
</div>
</fieldset>
</form>
</div>
</li>
</ul>
<div class="clearfix"></div>
</div><!-- /.slideMenu -->
</div><!-- /.container -->
</nav><!-- /.navMenu -->
<sly data-sly-include = "loginModal.html"></sly>
</div>
<!--/.topnav-->
</div>
I am trying from last 1 day and not able to figure out. Please help me on this.
Views
Replies
Total Likes
Please check whether these sling models are registered correctly as i mentioned before.
Views
Replies
Total Likes
Dear All,
The issue is fixed now. I was getting null pointer exception in my TopNav JAVA class. So changed like below and it is working fine.
if (currentPage != null) {
Page homePage = currentPage.getAbsoluteParent(SiteConstants.HOMEPAGE_PARENT_DEPTH);
if (homePage != null)
{
locale = homePage.getLanguage(true);
}
}
}
Views
Replies
Total Likes
Views
Likes
Replies