Introduction

Recently, the new JDK version, 11.0.20, was released, but some users have encountered exceptions during startup, particularly with Liferay. This article discusses the issue, provides insight into the cause, and suggests a workaround to avoid the problem.



Avoiding Exceptions with JDK 11.0.20+

The exceptions encountered during startup are related to a change in the JDK’s zip file validation. The issue can be traced to JDK-8302483. While the new zip file validation is a valuable addition, it currently disrupts the proper startup of some applications.

Temporary Solution

If you are using JDK 11.0.20 and facing these exceptions, a temporary solution is to add the following command line parameter to your startup configuration:

-Djdk.util.zip.disableZip64ExtraFieldValidation=true

You can modify the tomcat/bin/setenv.sh or tomcat/bin/setenv.bat file and add the parameter to the JDK_JAVA_OPTIONS or CATALINA_OPTIONS variable, respectively. This change will prevent the zip file validation from causing startup issues.

Long-Term Outlook

While avoiding JDK 11.0.20 might be a quick fix, it is not a sustainable solution. Future JDK releases, such as 11.0.21 and beyond, are unlikely to remove this zip file validation feature. Therefore, it is essential to implement the provided command line parameter in your environment.

Confirmation from Liferay

Liferay acknowledges the issue and plans to set the mentioned command line parameter as a proper system property in their future updates. However, if you are running on Liferay versions 7.0, 7.1, 7.2, 7.3, or an earlier 7.4 version, you must apply the workaround manually. The confirmation response from Liferay can be found here.

Users have reported issues when building their workspaces under Java 11.0.20. The development team is investigating the matter. Until the Developer Tools team addresses the build issues, it is recommended to refrain from using JDK 11.0.20 for any projects, especially if you are building for older Liferay versions (7.0 – 7.3, possibly 7.4 bundles before version 85). Sticking with JDK 11.0.19 may be necessary until your toolchain is updated to be compatible with JDK 11.0.20.

Conclusion

Conclusion JDK 11.0.20 introduces a new zip file validation feature that may cause exceptions during application startup. To avoid these issues, users should include the provided command line parameter in their environment configuration. While some temporary workarounds exist, it is crucial to prepare for long-term solutions, as future JDK versions are likely to retain this feature. Stay informed with updates from Liferay as they work towards incorporating the workaround into their system properties.

Note: This repurposed article is based on the original work by David H Nebinger.

Original Article Source:
The original article was published by David H Nebinger on Liferay.Dev. The article can be found here. [https://liferay.dev/blogs/-/blogs/important-jdk-11-0-20-notice]