Heh. We ran into this when we were looking at creating Confluence plugins: https://community.developer.atlassian.com/t/confluence-templ...
We're not a Java team, so it took us far too long to release this was the issue we were running into, and why it wasn't consistent between a few environments.