Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

HtmlLibraryManager cannot be resolved to a type

Avatar

Level 3

We have custom implementation to find the pages / assets which do not have jcr:content.

It was working fine AEM 6.0 version but we are migrating to AEM 6,3 now and we are facing the below error when we open the page

Error during include of component '/apps/misc-tools/components/missingNode'

Error Message:

org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: 
Unable to compile class for JSP:  An error occurred at line: 20
in the generated java file Only a type can be imported. com.day.cq.widget.HtmlLibraryManager resolves to a package 
An error occurred at line: 24 in the jsp file: /apps/misc-tools/components/init/init.jsp HtmlLibraryManager cannot be resolved to a type 21: --%>
<%@include file="/libs/foundation/global.jsp" %>
<% 22: %><%@page import="com.day.cq.wcm.api.WCMMode,com.day.cq.widget.HtmlLibraryManager"%>
<% 23: //if (WCMMode.fromRequest(request) != WCMMode.DISABLED) {
24: HtmlLibraryManager htmlMgr = sling.getService(HtmlLibraryManager.class);
25: if (htmlMgr != null) {
26: htmlMgr.writeCssInclude(slingRequest, out, "cq.wcm.edit");
27: htmlMgr.writeJsInclude(slingRequest, out, "cq.wcm.edit");


Below is the code we have in init.jsp

<%@include file="/libs/foundation/global.jsp" %><%

%><%@page import="com.day.cq.wcm.api.WCMMode,com.day.cq.widget.HtmlLibraryManager"%><%

//if (WCMMode.fromRequest(request) != WCMMode.DISABLED) {

    HtmlLibraryManager htmlMgr = sling.getService(HtmlLibraryManager.class);

    if (htmlMgr != null) {

        htmlMgr.writeCssInclude(slingRequest, out, "cq.wcm.edit");

        htmlMgr.writeJsInclude(slingRequest, out, "cq.wcm.edit");

    }

    String dlgPath = null;

    if (editContext != null && editContext.getComponent() != null) {

        dlgPath = editContext.getComponent().getDialogPath();

    }

//}

%>

Tried downloading the dependency for com.day.cq.widgets but it also throws below error

[INFO] ------------------------------------------------------------------------

Could not find artifact com.adobe.granite:com.day.cq.widget:jar:6.0.0 in adobe-public-releases (https://repo.adobe.com/nexus/content/groups/public)

Can anyone help me on this

Thanks in advance ,

Premchand

4 Replies

Avatar

Level 10

Trying to consume the AEM strongly typed APIs in 6.3 in JSP is older development pattern. Rework this component and use the AEM UBER 6.3 JAR file. Also we recommend converting your components to HTL and move away from JSP.

Avatar

Level 1

I am using AEM uber 6.3 Jar file. Bundle is resolved but i am getting similar exception

An error occurred at line: 25 in the generated java file

Only a type can be imported. com.day.cq.widget.HtmlLibraryManager resolves to a package

Tried recompiling all jsp, however no luck. Is there any suggestion you can provide?

Thanks,

Chat

Avatar

Community Advisor

Hi,

Please note that com.day.cq.widget.HtmlLibraryManager is deprecated since 6.1, replacement for the same - com.adobe.granite.ui.clientlibs.HtmlLibraryManager

HtmlLibraryManager ("The Adobe AEM Quickstart and Web Application.")

Avatar

Level 1

If it has been deprecated then the Adobe team should update /libs/wcm/foundation/components/responsivegrid/responsivegrid.html and remove the reference.