go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Increase Java heap for Tomcat
 
Subject: Increase Java heap for Tomcat
Author: Linux
In response to: Deploy your own web application into Tomcat
Posted on: 10/12/2011 09:37:25 PM

Edit the Tomcat startup script "bin/catalina.sh", find the section below:

if [ -z "$LOGGING_MANAGER" ]; then
  JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
else
  JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER"
fi

and then add:
JAVA_OPTS="$JAVA_OPTS -Xms128M -Xmx512M"


You'll have to restart Tomcat with bin/shutdown.sh; bin/startup.sh for this change to take effect.

 

> On 10/12/2011 09:32:17 PM Linux wrote:

Now, we'll install our web application and tweak the Tomcat configuration a bit. First, edit the conf/server.xml file. Look for the connector for port 8080:
 <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />


and change the port from 8080 to 80, so that your web server is accessible on the normal HTTP port. Next, find the Host tag (near the end of the file):
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">


Change autoDeploy to "false". Finally, inside the <Host> tag, add a <Context> tag for your application like this:
   <Context docBase="myApps.war" path="" />


Now you can close server.xml.

Next you need to build a WAR file for your application -- in Eclipse, you can do this by right-clicking on the project in Package Explorer, choosing "Export...", and choose "Web -> WAR file" from the list of export formats. Copy it to the instance using a command like this (on your local machine, not the EC2 instance):
# scp -i ~/.ec2/Tomcat2.pem myApps.war
 root@INSTANCE_PUBLIC_DNS_NAME:/env
/tomcat/apache-tomcat-6.0.33/webapps/myApps.war


Next, remove the default ROOT application, or at least move it out of the way:
mv webapps/ROOT webapps/xROOT


Otherwise, Tomcat won't serve your application at the root path, even if you've configured it that way.

Finally, restart Tomcat to pick up all the changes:
bin/shutdown.sh; bin/startup.sh 





References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.