1

I have a Grails app that I have packed with the war command: grails war. I need to deploy it to a remote machine running Tomcat.

When I do the drop deploy (copying the WAR file into C:\Program Files (x86)\apache-tomcat-7.0.37\webapps) and run C:\Program Files (x86)\apache-tomcat-7.0.37\bin\startup.bat I am getting several OutofMemory errors with PermGem and Heap space.

How can I fix this?

4

5 回答 5

4

What I usually do when starting tomcat :

export JAVA_OPTS="-Xms1024m -Xmx2024m -XX:MaxPermSize=512m"; export CATALINA_OPTS="-Xms1024m -Xmx2024m -XX:MaxPermSize=512m"; /etc/init.d/tomcat6 restart; tail -f /var/lib/tomcat6/logs/catalina.out

That fixes all memory problems. I have 6 Grails applications running with that configuration.

于 2013-03-22T15:39:55.293 回答
3

On the Tomcat server, add a system environment variable: JAVA_OPTS -Xmx512m

Also, in your Grails app in the conf/BuildConfig.groovy add the line at the following line at the top: grails.tomcat.jvmArgs= ["-Xms256m", "-Xmx1024m", "-XX:PermSize=512m", "-XX:MaxPermSize=512m"]

This seems to have solved many of the issues I was facing.

于 2013-03-22T15:15:08.177 回答
0

If you are using Ubuntu, I'd recommend editing /etc/default/tomcat6 (or tomcat7 depending on what you're running).

Around line 20 is a sample JAVA_OPTS line; uncomment it, and edit it to suit your hardware.

I've got mine running as:

 JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC"

Which caps the RAM in use at a gig, and sets permsize to 512m.

于 2013-03-25T22:21:40.603 回答
0

Use the default values on Grails Build.config Change on this point:

grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
//  compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],

// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: true, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 500, minMemory: 64, debug: true, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 500, minMemory: 64, debug: true, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 500, minMemory: 64, debug: true, maxPerm: 256]

]

于 2014-09-09T02:44:37.553 回答
0

if you are using service based tomcat then you may not have catalina.bat file in bin folder. Then try to add these java options. enter image description here

于 2014-10-07T16:36:23.577 回答