Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.
SOLVED

AEM 6.0 having some issues with java 1.8.

Avatar

Level 4

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. 

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

4 Replies

Avatar

Level 10

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

Avatar

Correct answer by
Level 10

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.

Avatar

Level 8

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. 

Avatar

Level 4

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)