View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

Installation/Custom/Apache Tomcat

Tomcat

Contents

Apache Tomcat

For the specific versions supported and the currently recommended version check the System Requirements.

Installing Apache Tomcat on Microsoft Windows

  1. Download and install Apache Tomcat.
  2. The download you want is the 32-bit/64-bit Windows Service Installer, as that will integrate it as Windows Service.
    1. Run that installer.
    2. It will ask if it should install several optional components (documentation, manager application, host manager application, example application). Openbravo does not need any of those they should not be marked.
    3. For the port configuration the rest of the guide assumes the standard ports 8005, 8080, 8009.
  3. Add CATALINA_HOME, CATALINA_BASE and CATALINA_OPTS environment variables:
    1. Right-click on My Computer.
    2. Select Properties. The system properties window appears.
    3. Select the Advanced tab.
    4. Click Environment Variables.
    5. Click New. The New System Variable box appears.
    6. In the Variable name field, type CATALINA_HOME.
    7. In the Variable value field, type the path of the Apache Tomcat installation directory. This is usually C:\Apache Software Foundation\Tomcat 7.0.
    8. Click OK.
    9. Click New. The New System Variable box appears.
    10. In the Variable name field, type CATALINA_BASE.
    11. In the Variable value field type %CATALINA_HOME%.
    12. Click OK
    13. Click New. The New System Variable box appears.
    14. In the Variable name field, type CATALINA_OPTS.
    15. In the Variable value type -server -Djava.awt.headless=true -Xms384M -Xmx1024M.
  4. Configure values in the tomcat service manager application. After the installation there will be a new icon in the windows System Tray which can be used to start / stop the tomcat service and also configure it.
    1. In the configure window, go to the Java tab
      1. Add -server -Djava.awt.headless=true to the end of the Java Options
      2. Change the Initial Memory Pool to 384M
      3. Change the Maximum Memory Pool to 1024M

As you will have noticed that item 4 above makes sure that the settings just done now match the ones done via the CATALINA_OPTS variable.

If you change any one of the two later it is important to edit then in both places.

Bulbgraph.png   More information about managing environment variables in Microsoft's Help & Support site
Bulbgraph.png   Known issue (for releases before 3.0PR15Q1)

16452: On Windows Openbravo won't start if the installation path contains a space

  1. In order to avoid Tomcat from auto-reloading itself, comment the WatchedResource line in C:\Apache Software Foundation\Tomcat 7.0\conf\context.xml:
    <!-- <WatchedResource>WEB-INF/web.xml</WatchedResource> -->
  2. On startup Tomcat will try to load active session from before last shutdown again. As that is not supported and cannot work with Openbravo switch it off by uncommenting the following line in the same context.xml file:
    <!-- <Manager pathname="" /> -->

You can check that Tomcat is running by opening http://localhost:8080 in a web browser.

Installing for development use (non production)

As development use here is meant a simple installation of tomcat without another Http server like Apache in front of it.

In addition to the global config above the following changes should be done.

  1. In the config/server.xml file of tomcat comment out the Connector entry for AJP on port 8009 as that is not useful without a Apache server in front of it.
  2. For the Http Connector on port 8080 add the following attribute to it:
    1. URIEncoding="UTF-8"
  3. Optionally disable the tomcat access log if you do not want to have a access log file with one line for every http request. For this comment out the following line:
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" pattern="%h %l %u %t "%r" %s %b" suffix=".txt" prefix="localhost_access_log." directory="logs"/> -->

Installing for production use

Production use here means a Apache HTTP server in front of tomcat to take care of several extra tasks as:

In addition to the global config above the following changes should be done.

  1. In the config/server.xml file of tomcat comment out the Http Connector entry for port 8080 as it will not be used at all.
<!-- <Connector port="8080" redirectPort="8443" connectionTimeout="20000" protocol="HTTP/1.1"/> -->
  1. For the AJP Connector on port 8009 add the following two attributes to it:
    1. URIEncoding="UTF-8"
    2. address="localhost"
  2. Also disable the builtin tomcat access log as the Apache server in front of it has one also with more information already. For this comment out the following line:
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve" pattern="%h %l %u %t "%r" %s %b" suffix=".txt" prefix="localhost_access_log." directory="logs"/> -->

How to use the installed Tomcat

This questions tries to address some frequently asked questions.

Installing Apache Tomcat on RedHat

Bulbgraph.png   This part is community maintained only and may contain outdated information.
yum install tomcat6 tomcat6-webapps tomcat6-servlet-2.5-api tomcat6-admin-webapps

Uncomment and edit in /etc/tomcat6/tomcat-users.xml to set passwords to your likings, then run it with 'service tomcat6 start'. If all is well you should now find the tomcat default page at http://yourhostname:8080/ .

OR

  1. Download the apache-tomcat-6.0.XY.tar.gz file from Apache Tomcat 6.0 and place it in /tmp/.
  2. Uncompress it:
    su -
    cd /usr/local
    tar zxvf /tmp/apache-tomcat-6.0.XY.tar.gz
    mv apache-tomcat-6.0.XY/ tomcat
  3. Add CATALINA_HOME, CATALINA_BASE and CATALINA_OPTS environment variables:
    echo 'export CATALINA_HOME=/usr/local/tomcat' > /etc/profile.d/tomcat.sh
    echo 'export CATALINA_BASE=/usr/local/tomcat' >> /etc/profile.d/tomcat.sh
    echo 'export CATALINA_OPTS="-server -Djava.awt.headless=true -Xms384M -Xmx1536M -XX:MaxPermSize=256M"' >> /etc/profile.d/tomcat.sh
    chmod +x /etc/profile.d/tomcat.sh
    chown -R openbravo:openbravo /usr/local/tomcat
    Workaround jvm-printing crash issue ( http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1710 ) ( https://bugs.openjdk.java.net/browse/JDK-8039050 )
    Running some specific jasper reports on top of some versions of jdk-6 and all of jdk-7 causes tomcat to crash. A workaround is to add this parameter to CATALINA_OPTS:
     echo '# Workaround jvm-printing crash issue: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1710  https://bugs.openjdk.java.net/browse/JDK-8039050' >> /etc/profile.d/tomcat.sh
     echo 'export CATALINA_OPTS="$CATALINA_OPTS -XX:CompileCommand=exclude,net/sf/jasperreports/engine/export/JRGridLayout,horizontallyMergeEmptyCells"' >> /etc/profile.d/tomcat.sh 
  4. Download this init script and place it into /etc/init.d/tomcat. Then make it executable:
    chmod +x /etc/init.d/tomcat
  5. Copy the tools.jar library
    cp $JAVA_HOME/lib/tools.jar /usr/local/tomcat/lib/
  6. In order to avoid Tomcat from auto-reloading itself, comment the WatchedResource line in /usr/local/tomcat/conf/context.xml:
    <!-- <WatchedResource>WEB-INF/web.xml</WatchedResource> -->
  7. Configure a username and password for the Tomcat Manager, by replacing the /usr/local/tomcat/conf/tomcat-users.xml file with these contents, replacing password="admin" with your chosen password:
    <?xml version='1.0' encoding='utf-8'?>
    
    <tomcat-users>
    <role rolename="manager"/>
    <role rolename="admin"/>
    <user username="admin" password="admin" roles="admin,manager"/>
    </tomcat-users>

Tomcat through a proxy

If your network have a proxy, you need to append this to the tomcat configuration:

CATALINA_OPTS='-Dhttp.proxySet=true -Dhttp.proxyHost=[PROXY SERVER] -Dhttp.proxyPort=[PORT]'

Retrieved from "http://wiki.openbravo.com/wiki/Installation/Custom/Apache_Tomcat"

This page has been accessed 53,380 times. This page was last modified on 15 June 2015, at 15:25. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.