Skip to main content
Level 4
Oct 16, 2015 2:28 AM UTC
Solved

AEM 6.0 having some issues with java 1.8.

Hello All,

In my current project, I am installing AEM 6.0 with Java 1.8. I have also installed service pack 1 and service pack 2. But after I do a maven build successfully, when I try to load the page it always fails and shows the following error.

Initially, it worked fine but later I don't know why it started failing.

com.day.cq.wcm.tags.IncludeTag Error while executing script body-section-header.jsp
org.apache.sling.api.scripting.ScriptEvaluationException: org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 38 in the generated java file
Only a type can be imported. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Sham_HC
Sham_HCAccepted solution
Level 10
Oct 16, 2015 2:28 AM UTC

Your description indicates some reinstallation happened either at os level (jdk upgrade or envirnoment variable modification) or at aem product level.  Without complete logs & call tough to find out.  File an official support request.

4 replies

Level 4
Oct 16, 2015 2:28 AM UTC

Please find the complete log. 

Unable to compile class for JSP: An error occurred at line: 95 in the jsp file: /libs/granite/core/components/login/login.jsp The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files 92: ? request.getParameter(PARAM_NAME_REASON) 93: : ""; 94: 95: if (!StringUtils.isEmpty(reason)) { 96: if (validReasons.containsKey(reason)) { 97: reason = validReasons.get(reason); 98: } else { An error occurred at line: 95 in the jsp file: /libs/granite/core/components/login/login.jsp The method isEmpty(CharSequence) in the type StringUtils is not applicable for the arguments (String) 92: ? request.getParameter(PARAM_NAME_REASON) 93: : ""; 94: 95: if (!StringUtils.isEmpty(reason)) { 96: if (validReasons.containsKey(reason)) { 97: reason = validReasons.get(reason); 98: } else {

Cannot serve request to /libs/granite/core/content/login.html in /libs/granite/core/components/login/login.jsp

Exception:

org.apache.sling.scripting.jsp.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 95 in the jsp file: /libs/granite/core/components/login/login.jsp The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files 92:             ? request.getParameter(PARAM_NAME_REASON) 93:             : ""; 94: 95:     if (!StringUtils.isEmpty(reason)) { 96:         if (validReasons.containsKey(reason)) { 97:             reason = validReasons.get(reason); 98:         } else { An error occurred at line: 95 in the jsp file: /libs/granite/core/components/login/login.jsp The method isEmpty(CharSequence) in the type StringUtils is not applicable for the arguments (String) 92:             ? request.getParameter(PARAM_NAME_REASON) 93:             : ""; 94: 95:     if (!StringUtils.isEmpty(reason)) { 96:         if (validReasons.containsKey(reason)) { 97:             reason = validReasons.get(reason); 98:         } else { at org.apache.sling.scripting.jsp.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) at org.apache.sling.scripting.jsp.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) at org.apache.sling.scripting.jsp.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:421) at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:312) at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:290) at org.apache.sling.scripting.jsp.jasper.compiler.Compiler.compile(Compiler.java:277) at org.apache.sling.scripting.jsp.jasper.JspCompilationContext.compile(JspCompilationContext.java:501) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.prepareServlet(JspServletWrapper.java:427) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:486) at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449) at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:265) at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:87) at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:465) at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361) at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171) at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463) at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:511)
Translate
Level 8
Oct 16, 2015 2:28 AM UTC

You can't install AEM 6 with 1.8. First you have install it with 1.7 and then apply service pack 1 or 2 which both support 1.8. After you have applied the service packs you can shut down and then restart using 1.8. The compilation error is what happens when you try to run a base AEM 6 with 1.8 without applying the service packs. 

Translate
Sham_HC
Sham_HCAccepted solution
Level 10
Oct 16, 2015 2:28 AM UTC

Your description indicates some reinstallation happened either at os level (jdk upgrade or envirnoment variable modification) or at aem product level.  Without complete logs & call tough to find out.  File an official support request.

Translate
Lokesh_Shivalingaiah
Level 10
Oct 16, 2015 2:28 AM UTC

Check if the Java class referred in the JSP is also been compiled in JAVA 8

Translate