Facing Duplicate local variable error in JSP | Community
Skip to main content
Level 2
January 8, 2025

Facing Duplicate local variable error in JSP

  • January 8, 2025
  • 4 replies
  • 1336 views

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.

 

4 replies

konstantyn_diachenko
Community Advisor
Community Advisor
January 8, 2025

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.

Kostiantyn Diachenko, Community Advisor, Certified Senior AEM Developer, creator of free AEM VLT Tool, maintainer of AEM Tools plugin.
SreenivasBr
Level 4
January 8, 2025

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

MeghaGoAuthor
Level 2
January 9, 2025

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>

kautuk_sahni
Community Manager
Community Manager
January 27, 2025

@meghago Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni
kautuk_sahni
Community Manager
Community Manager
January 27, 2025

@meghago Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni