Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.