Wiki source code of XWiki Startup Failure after a Required Java Upgrade
Last modified by Eleni Cojocariu on 2026/08/13 15:14
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 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. | ||
| 2 | |||
| 3 | {{code language="none"}} | ||
| 4 | Context [/xwiki] startup failed due to previous errors | ||
| 5 | {{/code}} | ||
| 6 | |||
| 7 | === Cause === | ||
| 8 | |||
| 9 | 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: | ||
| 10 | |||
| 11 | {{code language="none"}} | ||
| 12 | [info] JVM Version: 11.0.21+9-post-Ubuntu-0ubuntu122.04 | ||
| 13 | {{/code}} | ||
| 14 | |||
| 15 | The 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. | ||
| 16 | |||
| 17 | === Solution === | ||
| 18 | |||
| 19 | 1. Read the JVM version the container reports in its log, and compare it with the [[Java version XWiki requires>>dev:Community.SupportStrategy.JavaSupportStrategy.WebHome]]. | ||
| 20 | 1. Check the container's configuration file for a ##JAVA_HOME## setting, and point it at the required JDK. | ||
| 21 | 1. Check the ##default-java## link when the configuration sets no ##JAVA_HOME##:((( | ||
| 22 | {{code language="none"}} | ||
| 23 | ls -l /usr/lib/jvm/ | ||
| 24 | {{/code}} | ||
| 25 | ))) | ||
| 26 | 1. Repoint that link at the required JDK when it still resolves to the old one:((( | ||
| 27 | {{code language="none"}} | ||
| 28 | cd /usr/lib/jvm | ||
| 29 | sudo rm default-java | ||
| 30 | sudo ln -s java-21-openjdk-amd64 default-java | ||
| 31 | {{/code}} | ||
| 32 | ))) | ||
| 33 | 1. Restart the servlet container, and confirm that the JVM version it now reports is the required one. |