Accessing Virtual Machine Tomcat Server from Host

Apache Tomcat is a Web server that serves out static pages over the Internet to Web browsers, as well as dynamic content generated from Java programs and pages written in JSP (JavaServer Pages). Apache Tomcat is preinstalled at $CATALINA_HOME directory on the provided virtual machine and automatically starts when you turn on the virtual machine. The Tomcat server waits for HTTP requests by listening on the port 8080 on your VM, which is redirected to port 1448 on your host machine.

Now open http://localhost:1448/ using a web browser in your host. If you see a page with the following content, your Tomcat server is sucessfully running!

It works !

If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!

This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat7/webapps/ROOT/index.html

Tomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat7 and CATALINA_BASE in /var/lib/tomcat7, following the rules from /usr/share/doc/tomcat7-common/RUNNING.txt.gz.

You might consider installing the following packages, if you haven't already done so:

tomcat7-docs: This package installs a web application that allows to browse the Tomcat 7 documentation locally. Once installed, you can access it by clicking here.

tomcat7-examples: This package installs a web application that allows to access the Tomcat 7 Servlet and JSP examples. Once installed, you can access it by clicking here.

tomcat7-admin: This package installs two web applications that can help managing this Tomcat instance. Once installed, you can access the manager webapp and the host-manager webapp.

NOTE: For security reasons, using the manager webapp is restricted to users with role "manager-gui". The host-manager webapp is restricted to users with role "admin-gui". Users are defined in /etc/tomcat7/tomcat-users.xml.

You can add your own HTML pages and Java classes to the directory where Tomcat serves its content from ($CATALINA_BASE/webapps) and make them available through Tomcat. We will provide more detailed instructions on how to do this later.

If you need to restart your Tomcat server for any reason, run the following command on your VM:

sudo /etc/init.d/tomcat7 restart