Issue
- The following warning occurs in the logs while configuring the WebSphere application server with Liferay.
WARN [WebContainer : 4][code_jsp:162] {code="500", msg="JSPG0049E: /html/common/themes/top_head.jsp failed to compile : __JSPG0225E: An error occurred at line: 21 in the statically included file: /html/common/themes/top_portlet_resources_css.jspf_JSPG0093E: Generated servlet error from file: /html/common/themes/top_head.jsp __/was/IBM/WebSphere/AppServer/profiles/portal1/temp/UAT-APP2-ITFO-portal1/portal1/liferay-dxp-7_3_10_1-sp1-202103111649_war/liferay-dxp-7.3.10.1-sp1-202103111649.war/html/common/themes/_top_5F_head.java : 825 : Lambda expressions are allowed only at source level 1.8 or above__JSPG0225E: An error occurred at line: 24 in the statically included file: /html/common/themes/top_portlet_resources_js.jspf_JSPG0093E: Generated servlet error from file: /html/common/themes/top_head.jsp __/was/IBM/WebSphere/AppServer/profiles/portal1/temp/UAT-APP2-ITFO-portal1/portal1/liferay-dxp-7_3_10_1-sp1-202103111649_war/liferay-dxp-7.3.10.1-sp1-202103111649.war/html/common/themes/_top_5F_head.java : 1738 : Lambda expressions are allowed only at source level 1.8 or above_", uri=/html/common/themes/portal.jsp} [Sanitized] error.
Environment
- Liferay DXP 2024.Q1 and below version
Resolution
- The above warnings indicate that Liferay is attempting to compile JSP files containing lambda expressions. However, the Java compiler being used does not support them because the source level is set below Java 1.8.
-
IBM documentation, stating that the error message "
Lambda expressions are allowed only at source level 1.8 or above" occurs because the jdkSourceLevel does not allow the value 18. As a result, the 18 source-level option cannot be passed to the compiler in fix pack 8.5.5.11. - In WebSphere 9.0.5.20, where the default source level is 17 (as per WebSphere 9 documentation), this means it enables JDK 7.0 features by default. To use JDK 8.0 features, set the value to 18 in the ibm-web-ext.xmi file and save it.
-
Kindly check ibm-web-ext.xmi file and update the source level to 18 to see if the issue persists.
-
For further insights, here is Liferay’s official documentation on Setting the JDK Version for Compiling JSPs:
DXP requires that its JSPs are compiled to the Java 8 bytecode format. To ensure that WebSphere does this, shut down WebSphere after you’ve deployed the DXP
.warfile. Navigate to theWEB_INFfolder and add<jsp-attribute name="jdkSourceLevel" value="18" />to theibm-web-ext.xmlor in most cases theibm-web-ext.xmifile.
-