DB Upgrade to a Q2 release using JDK 21 results in an error
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- The following error is being encountered when trying to upgrade to a Q2 release running ./db_upgrade_client.sh and using JDK 21
JVM arguments: [-Dfile.encoding=UTF8, -Duser.country=US, -Duser.language=en, -Duser.timezone=GMT, -Xmx2048m, -Dexternal-properties=portal-upgrade.properties, -Dliferay.shielded.container.lib.portal.dir=/home/me/Downloads/liferay-dxp-tomcat-2024.q2.1-1718608609/liferay-dxp/tomcat/webapps/ROOT/WEB-INF/shielded-container-lib, -Dserver.detector.server.id=tomcat]
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens=java.base/sun.util.calendar=ALL-UNNAMED --add-opens=jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.liferay.petra.string.StringBundler$StringConcatenator.<clinit>(StringBundler.java:470)
at com.liferay.petra.string.StringBundler._toStringStringConcatenator(StringBundler.java:304)
at com.liferay.petra.string.StringBundler._toString(StringBundler.java:276)
at com.liferay.petra.string.StringBundler.toString(StringBundler.java:242)
at com.liferay.portal.kernel.util.SystemProperties._load(SystemProperties.java:238)
at com.liferay.portal.kernel.util.SystemProperties.load(SystemProperties.java:119)
at com.liferay.portal.kernel.util.SystemProperties.<clinit>(SystemProperties.java:304)
at com.liferay.portal.kernel.log.SanitizerLogWrapper.<clinit>(SanitizerLogWrapper.java:293)
at com.liferay.portal.kernel.log.LogFactoryUtil.getLog(LogFactoryUtil.java:35)
at com.liferay.portal.kernel.log.LogFactoryUtil.getLog(LogFactoryUtil.java:20)
at com.liferay.portal.tools.DBUpgrader.<clinit>(DBUpgrader.java:433)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160)
at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:300)
at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newMethodAccessor(MethodHandleAccessorFactory.java:71)
at java.base/jdk.internal.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:159)
at java.base/java.lang.reflect.Method.acquireMethodAccessor(Method.java:726)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:45)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field static final java.lang.invoke.MethodHandles$Lookup java.lang.invoke.MethodHandles$Lookup.IMPL_LOOKUP accessible: module java.base does not "opens java.lang.invoke" to unnamed module @1de0aca6
at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:177)
at com.liferay.petra.string.StringBundler$ByteArrayStringConcatenator.<clinit>(StringBundler.java:370)
... 19 more
Environment
- Any previous version upgraded to a Q2 release using JDK 21
Resolution
- Please open a Support Ticket requesting a hotfix with the fix LPD-29270
- You should also replace the JAR file named com.liferay.portal.tools.db.upgrade.client.jar with the one attached here.
Did this article resolve your issue ?