Sometimes, we have seen in logs same exception occurs continuously and you get full stacktrace of that exception. But after some time, you just get only exception message not full stack trace. The reason for this is below from java doc.
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: