MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment

Revision 8 as of 2014-06-10 20:47:03
  • Java
  • Tomcat

Tomcat

Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies.

Installation on Slackware

  • cd ~/Downloads
  • wget http://mirrors.fe.up.pt/pub/apache/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz

  • su
  • cp apache-tomcat-7.0.53.tar.gz /opt
  • cd /opt
  • tar xvzf apache-tomcat-7.0.53.tar.gz
  • chown vitor * -R
  • chgrp users * -R
  • exit

Start Tomcat

/opt/apache-tomcat-7.0.53/bin/ ./startup.sh http://localhost:8080/

Add admin user

  • cd /opt/apache-tomcat-7.0.53/conf

Edit tomcat-users.xml

  <role rolename="admin"/>
  <role rolename="manager"/>
  <role rolename="manager-gui"/>
  <user username="admin" password="12345678" roles="admin,manager,manager-gui"/
  • ./shutdown.sh
  • ./startup.sh

WebApps location

  • /opt/apache-tomcat-7.0.53/webapps

A WAR file can be copied or exploded in the webapps folder.

Sample App

Download http://localhost:8080/docs/appdev/sample/sample.war and deploy in the webapps folder. After the deploy the WAR file is exploded.

Configuration values in web.xml for WAR file

Adapted from http://stackoverflow.com/questions/372686/how-can-i-specify-system-properties-in-tomcat-configuration-on-startup

   1 <env-entry>
   2     <env-entry-name>SMTP_PASSWORD</env-entry-name>
   3     <env-entry-type>java.lang.String</env-entry-type>
   4     <env-entry-value>abc123ftw</env-entry-value>
   5 </env-entry>

Get values in code:

   1 // Obtain our environment naming context
   2 Context initCtx = new InitialContext();
   3 Context envCtx = (Context) initCtx.lookup("java:comp/env");
   4 
   5 // Look up our data source
   6 String s = (String)envCtx.lookup("SMTP_PASSWORD");

== Change HTTP from port 8080 to port 8081 and AJP from 8009 to 8010== Edit file conf/server.xml

Change the HTTP Connector from 8080 to 8081. Change AJP1.3 connector from 8009 to 8010.

   1     <Connector port="8081" protocol="HTTP/1.1"
   2                connectionTimeout="20000"
   3                redirectPort="8443" />
   4 
   5     <!-- Define an AJP 1.3 Connector on port 8009 -->
   6     <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01