when you are using tomcat as you application server for not small application you can easy get (out of memory exception). this is because the default heap size tomcat use is small and suitable only for small web applications.
to set the start and maximum heap size run the following command before starting your tomcat:
export CATALINA_OPTS=”-Xms1024m -Xmx1024m”
export JAVA_OPTS=”-Xms1024m -Xmx1024m”
go to the tomcat_HOME/bin/catalina.sh. find the JAVA_OPTS parameter and modify to JAVA_OPTS=”-Xms1024m -Xmx1024m”
this will create environment variable called CATALINA_OPTS or JAVA_OPTS contains the required options to make tomcat start heap size 1024M and maximum heap size 1024M.