Tomcat Web Server
From Kb
Contact Article Author | Blog of Article Author | FirstPartners.net Home | LinkedIn profile of Author
See Also
- Deploying to Weblogic using Maven
- JBoss Information
- Oracle Application Server (OAS)
- Tomcat Web Server
- Websphere
- Weblogic
First steps
- Install Java
- Install Tomcat
- Use default port 8080 and default username / password (admin / blank)
- If these change , search for the relevant entries in the pom.xml and change to match
Command Line - stop and start Tomcat (on Windows)
- net stop "apache tomcat"
- net start "apache tomcat"
Deploying to Tomcat Manually
- Build war using mvn package
- Ensure Tomcat is running
- Go to http://localhost:8080
- Open the Manager application (normally at http://localhost:8080/manager)
- Use the web interface to deploy
Deploying to Tomcat with Maven
- Ensure Tomcat is running
- Follow the instructions at : http://mojo.codehaus.org/tomcat-maven-plugin/deployment.html more information on the goals are here: http://mojo.codehaus.org/tomcat-maven-plugin/context-goals.html
- Example: mvn war:exploded tomcat:exploded
- Example: mvn tomcat:run - start tomcat container inline
Most commonly used
- mvn war:exploded tomcat:deploy - 1st time
- mvn war:exploded tomcat:redeploy - subsequent times
All of these are from the web directory of the project
Deploying to Tomcat with Cargo
Add information
Using Maven and Jetty
- No Tomcat running
- mvn jetty:run-war in the web section of your project
Out of Memory / Out of Heap Errors
Add the following variable: MAVEN_OPTS=-Xms256m -Xmx1024m -XX:PermSize=1024m -XX:MaxPermSize=1024m
Debugging Web Applications on Tomcat and Eclipse
- Information from Tomcat Wiki , but if you have Tomcat installed as a windows service ...
- In the Tomcat Manger (right click green play icon in windows system tray)
- Open the Java Tab
- In the Java options textbox
- On separate lines , enter -Xdebug and -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n before the -D options.
- Restart windows service
- To Attach to process in Eclipse
- Run ... Open Debug Dialog ... Remote Java application .. New Configuration
- Localhost (or other) and the port number (8000) specified earlier
- Add breakpoints in code, Eclipse Monitors code and switches to debug view when breakpoint encountered.
Running Tomcat Through Eclipse
- Ensure you have the Web Tools Project installed
- New configuration, add details of the local server
- Run as Debug server , using pre build war file...
- Add breakpoints in code, Eclipse Monitors code and switches to debug view when breakpoint encountered.

