Improper or insufficient memory for JVM can cause the issue to occur. To solve this, try to allocate more space and RAM for JVM.