By default, and since Java 1.5, a JVM optimisation can hide stacktrace of frequently raised errors.
From release notes JDK 5.0 :
The compiler in the server VM now provides correct stack backtraces for all "cold" built-in exceptions. For performance purposes, when such an exception is thrown a few times, the method may be recompiled. After recompilation, the compiler may choose a faster tactic using preallocated exceptions that do not provide a stack trace. To disable completely the use of preallocated exceptions, use this new flag: -XX:-OmitStackTraceInFastThrow.
Since Exception are not used for control flow in SonarQube and are therefore very rare (target is there should never be any), this JVM optimization is not bringing any performance benefit to SonarQube.
On the contrary, it's bringing complexity in investigating issues faces by users/customers and their logs don't date back enough to get the original stacktrace of an error and the JVM optimization has since kicked in and no stacktrace is available anymore (eg. SUPPORT-16935).
This optimisation should be disabled in SonarQube.
JVM option to disable this optimisation (-XX:-OmitStackTraceInFastThrow) should be added to the options of the Web and CE processes in SonarQube.
Note that this option is also put (and non removable) in ElasticSearch.