# emerge -pv jdk
[ebuild R ] virtual/jdk-1.6.0 0 kB
# emerge -pv apache
# emerge -pv www-servers/tomcat
Reference Gentoo Tomcat Guide for tomcat webroot location and configuration. Tomcat configuration file is in /etc/init.d/tomcat-x.y.
In file /etc/tomcat-6/tomcat-users.xml, add admin user inside the <tomcat-users> tag:
<role rolename="manager"/>
<user username="tomcat" password="s3cret" roles="manager"/>
The default tomcat server port is 8080. To change that, modify the file /etc/tomcat-6/server.xml
# /etc/init.d/apache2 start
# /etc/init.d/tomcat-6 start
Then open localhost:8080 (or whatever your tomcat port is) to see tomcat is up. At this point, the default tomcat web root is at $CATALINA_HOME/webapps/ROOT/index.html.
The tomcat logs are located in /var/log/tomcat-6.
This article, http://www.coreservlets.com/Apache-Tomcat-Tutorial/, is a good reference. Though it is not written for tomcat on Gentoo. So beware of the directory difference.
# emerge -pv dev-java/ant
Source /etc/conf.d/tomcat-6 to get all the config variables. Then Add the jar file catalina-ant.jar to CLASSPATH:
# export CLASSPATH=${CLASSPATH}:${CATALINA_HOME}/lib/catalina-ant.jar
Without this jar file in the CLASSPATH, I would get the error "taskdef class org.apache.catalina.ant.DeployTask cannot be found" when running ant on a build.xml that calls org.apache.catalina.ant.DeployTask.
Goto http://www.springframework.org/download and download the latest. Download the spring framework with dependencies.
After download, unzip the package.
Follow http://www.springframework.org/docs/Spring-MVC-step-by-step/ to start a new Framework test package.
In the build.properties file, set these values to confirm to Gentoo's Tomcat installation:
appserver.home=/var/lib/tomcat-6
appserver.lib=/usr/share/tomcat-6/lib