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
Get values in code:
Change from port 8080 to port 8081
Edit file conf/server.xml
Change the Connector from 8080 to 8081