Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!

Facing Duplicate local variable error in JSP

Avatar

Level 2

While migrating from AEM on-premise to AEM cloud, facing Duplicate local variable errors in JSP. Below is the error:

org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: __An error occurred at line: 7 in the jsp file

We are assuming that the error might be because of below values in healthcheck config.

MeghaGo_0-1736350881719.png

 

6 Replies

Avatar

Level 8

Hi @MeghaGo ,

 

Try to localize a root cause: disable this OSGi component. If issue is reproduced, then the issue is not related to this component.

 

Please, share more logs to understand full context.

 

Best regards,

Kostiantyn Diachenko.

Avatar

Level 3

Can you provide the full stack trace of the error message and what is at line 7 in the jsp?

Avatar

Level 2

Below are some errors:

09.01.2025 12:35:20.588 *ERROR* [[0:0:0:0:0:0:0:1] [1736406320455] GET /content/abc/en/index.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
org.apache.sling.scripting.jsp.jasper.JasperException: /apps/myproject/components/page/basepage/head.jsp(38,0) useBean: Duplicate bean name: {0}
at org.apache.sling.scripting.jsp.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) [org.apache.sling.scripting.jsp:2.6.0]

 

Below code is available under head.jsp at line 38

<jsp:useBean id="pagePropertiesController" class="com.abc.myProject.bl.widgets.pageProperties.controller.PagePropertiesController">
<jsp:setProperty name="pagePropertiesController" property="slingRequest" value="<%=slingRequest%>" />
<jsp:setProperty name="pagePropertiesController" property="pageContext" value="<%=pageContext%>" />
</jsp:useBean>

Avatar

Level 2

Also, there is one more error i.e. com.adobe.acs.commons.util.ResourceDataUtil Error creating the String representation for: /content/abc/en/errors/500.html
org.apache.sling.api.SlingException: An exception occurred processing JSP page /libs/cq/Page/proxy.jsp at line 29 : /apps/myProject/components/page/basepage/head.jsp(38,0) useBean: Duplicate bean name: {0}
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:663) [org.apache.sling.scripting.jsp:2.6.0]

Avatar

Level 2

2025 12:35:20.588 *ERROR* [[0:0:0:0:0:0:0:1] [1736406320455] GET /content/abc/en/index.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
org.apache.sling.scripting.jsp.jasper.JasperException: /apps/myProject/components/page/basepage/head.jsp(38,0) useBean: Duplicate bean name: {0}

 

Below code is available at line 38 in head.jsp

<jsp:useBean id="pagePropertiesController" class="com.aetna.myProject.bl.widgets.pageProperties.controller.PagePropertiesController">
<jsp:setProperty name="pagePropertiesController" property="slingRequest" value="<%=slingRequest%>" />
<jsp:setProperty name="pagePropertiesController" property="pageContext" value="<%=pageContext%>" />
</jsp:useBean>

Avatar

Level 8

Can you please provide more context about this line and useBean function on 38 line:

/apps/myProject/components/page/basepage/head.jsp(38,0) useBean: Duplicate bean name: {0}