Handling the Stack OverFlow

Stack overflow
The JVM allocates a Java and native stack for each thread that is created by the application. If either of these stacks become exhausted, a stack overflow error occurs. A Java stack overflow can occur for the following reasons:

The stack is not large enough to handle the request. Setting the following JVM parameter increases the Java stack size to 1 MB:
-Xoss1m
The default is 400 KB.

The JIT compiler is causing a recursion in the application code. There is a recursion in the application code
A native stack overflow can occur for the following reasons:
The stack is not large enough to handle the request. Setting the following JVM parameter increases the native stack size to 1 MB:

-Xss1m
The default is 400 KB.

Setting JVM parameters: To set a JVM parameter, use the Generic JVM arguments field for the application server. You can find this at Servers Application Servers Java and Process Management Process Definition Java Virtual Machine