Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Tomcat 7 on FreeBSD. I manually start it from

/usr/local/etc/rc.d

by executing

./tomcat7 onestart

I need to increase the heap size for one application which runs in Tomcat. I added

export JAVA_OPTS="-Xmx3000m"

to

/usr/local/apache-tomcat-7.0/bin/catalina.sh

but that has no effect. Deployment always fails with an out of memory exception. I edited setenv.sh but that also has no effect. For Tomcat 6 on Ubuntu 10.04 these settings worked.

What am I doing wrong?

share|improve this question
up vote 0 down vote accepted

Try looking in /usr/local/etc/rc.d/tomcat7. There is probably an option to set the heap size there that is passed directly to Java.

This is an example of my Tomcat init script which I just copied from $TOMCAT/bin/service.sh. It won't look exactly like yours as I've modified it heavily, but it should give you an idea of what you can do.

JAVA_HOME=/usr/java/default
CATALINA_HOME=/opt/tomcat-prod
DAEMON_HOME=/opt/tomcat-prod
TOMCAT_USER=svcitstomcat
PID_FILE=/var/run/jsvc-tomcatprod.pid
CATALINA_BASE=/opt/tomcat-prod
CLASSPATH=$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/commons-logging-api.jar:\
$CATALINA_HOME/bin/bootstrap.jar
LOGS=$CATALINA_HOME/logs
JAVA_OPTS=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"\
"-  Djava.util.logging.config.file="$CATALINA_HOME/conf/logging.properties"


case "$1" in
  start)
    #
    # Start Tomcat
    #
    $DAEMON_HOME/bin/jsvc \
    -Xms1024M -Xmx1024M \
    $JAVA_OPTS \
    -user $TOMCAT_USER \
    -home $JAVA_HOME \
    -Dcatalina.home=$CATALINA_HOME \
    -Dcatalina.base=$CATALINA_BASE \
    -Djava.io.tmpdir=$TMP_DIR \
share|improve this answer
    
There seems to be no service.sh in my $TOMCAT/bin. I experimented a little: if I manually start $TOMCAT/bin/startup.sh heap settings from catalina.sh are applied as I expected. – Florian Apr 20 '12 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .