XWiki Startup Failure after a Required Java Upgrade
Explanation
An XWiki version can require a newer Java version than the one you are running — Java 17 since XWiki 16.0.0, and Java 21 since XWiki 18.0.0. When the servlet container is still started with the previous Java, XWiki does not report a requirement error: the container only says that the web application failed.
Context [/xwiki] startup failed due to previous errorsCause
The servlet container runs its own JVM, chosen independently of the system default, so upgrading XWiki does not change it and installing a newer JDK does not necessarily change it either. Tomcat reports the version it uses shortly after starting:
[info] JVM Version: 11.0.21+9-post-Ubuntu-0ubuntu122.04The leading number is the Java version — 11 here, where XWiki 18 needs 21. Two things commonly pin it: a JAVA_HOME hard-wired in the container's configuration file, such as /etc/default/tomcat10, and, on Debian-based distributions, the default-java symbolic link that apt does not always repoint when a newer JDK is installed.
Solution
- Read the JVM version the container reports in its log, and compare it with the Java version XWiki requires.
- Check the container's configuration file for a JAVA_HOME setting, and point it at the required JDK.
- Check the default-java link when the configuration sets no JAVA_HOME:
ls -l /usr/lib/jvm/ - Repoint that link at the required JDK when it still resolves to the old one:
cd /usr/lib/jvm sudo rm default-java sudo ln -s java-21-openjdk-amd64 default-java - Restart the servlet container, and confirm that the JVM version it now reports is the required one.
FAQ
Does XWiki run on a newer Java than the one it requires?
Yes, within the versions the Java version XWiki requires lists as supported for your XWiki version — a version newer than those is not tested and may fail.
Are extra JVM options needed?
Yes, since Java 17 XWiki needs a set of add-opens switches, listed on the Java Support Strategy page. The Debian packages and the standalone distribution set them for you.