| Reported on the forum: https://forum.xwiki.org/t/xwiki-deploying-twice-when-context-path-variable-is-set-up/18732 Problem When the CONTEXT_PATH environment variable is set to anything other than ROOT, the container starts two XWiki webapps in the same Tomcat JVM. The second one to start fails with:
The 'org.xwiki.infinispan' JMX domain is already in use
and browsing the root URL returns a 404 while only http://localhost:8080/<CONTEXT_PATH> works. The log fills up with hundreds of those errors. Steps to reproduce
- Go to 18.4/postgres-tomcat.
- Add CONTEXT_PATH: wiki to the web service environment in docker-compose.yml.
- docker compose up.
Cause configure() in xwiki/docker-entrypoint.sh deploys the non-ROOT context like this:
mkdir -p -v /usr/local/tomcat/webapps/$CONTEXT_PATH
cp -a --update=none /usr/local/tomcat/webapps/ROOT/. /usr/local/tomcat/webapps/$CONTEXT_PATH/
This used to be a mv, changed to a merging copy in XDOCKER-402 so that a config file bind-mounted into the target context directory (e.g. a custom logback.xml) is not clobbered — mv cannot merge into an already-existing directory, which Docker creates before the entrypoint runs when such a mount is declared. The copy is correct, but nothing removes /usr/local/tomcat/webapps/ROOT afterwards, and Tomcat auto-deploys every directory under webapps/. So both ROOT and $CONTEXT_PATH are deployed as full XWiki webapps in the same JVM, and the loser of the race dies on the Infinispan JMX domain. Affected versions Every image generated after the XDOCKER-402 change (19 March 2026): 18.2.0 and later, 17.10.6 and later, all 18.4.x, and 16.10.18 and later. Verification Reproduced on the published xwiki:18.4.0-postgres-tomcat image with CONTEXT_PATH=wiki: Tomcat deploys both webapps/wiki and webapps/ROOT, and the log contains 284 Infinispan JMX errors. Adding rm -rf /usr/local/tomcat/webapps/ROOT after the copy makes it deploy wiki only, with zero such errors. |