This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Increasing the heap size would be one way to possibly fix this. However you should try and figure out what is causing the JVM to run out of memory. It could happen in DEV environments where apps are deployed often, so in those cases just restarting the app server would be fine. If this is a PROD environment, you should try and look at the source code where the exeption originates from and figure out why so much memory is being used, for instance large Collections or Maps, large Resultsets, etc. etc. In many cases, fixing the code (i.e. by properly scoping objects) can prevent situations where you run out of memory.