EE417 Home‎ > ‎Downloads‎ > ‎

Installing Tomcat

Tomcat 9.x

Tomcat is not only recommended for study of the module, but as a requirement when completing the assignment. It is required for deploying compiled, servlet class files and JSP pages. 

Important Considerations before Installing

  1. Ensure that you have installed the Java Standard Edition as described previously.  Tomcat utilises Java to deploy and execute and will not run in its absence.  
  2. Ensure that you have your environment variables setup as also described previously.  With these environment variables set, installation will proceed in a quicker and simpler manner.
  3. In the DCU labs, Tomcat version 5.5 is installed - there are no significant changes affecting this module in the new version and there should be no issues in using any versions between 5.5 and 9.X.

Instructions

  1. Download the following zip file containing a modified version of Tomcat 7.  This download of Tomcat has been configured in advance with a few small changes to make it more suitable for the course:      
  2. Unzip this into your chosen directory.  In the video, I place mine in C:\Java
  3. In Windows, navigate to the C:\Java\apache-tomcat-9.0.14\bin and run 'startup.bat'.  If a command prompt flashes up and disappears (probably before you can read it), please view the troubleshooting section below.
  4. Assuming no further problems, Tomcat will have started up.  It has been configured to load on port 80.  So to test this we can navigate to http://localhost   or  http://127.0.0.1  (we can omit the port 80 in the URL as it is the default port for HTTP).   If everything has proceeded correctly, you should receive a page indicating "If you're seeing this page via a web browser, it means you've setup Tomcat successfully." 
Additional Note for MAC Users
  • Some MAC users have indicated that Tomcat won't open correctly.  This appears to be due to an alternate program running on Port 80 by default.  To fix this, we will simply change the port that Tomcat will run on.
  • Edit conf/server.xml
  • Change the line: <Connector port="80" protocol="HTTP/1.1"   ...        to     <Connector port="8080" protocol="HTTP/1.1"
  • /bin/startup.sh
  • Visit  http://localhost:8080    or    http://127.0.0.1

Installation Video


Troubleshooting:

  • If after running 'startup.bat' you get a command window that simply appears for a moment quickly and then disappears it is difficult to determine the encountered error.  In order to see the error, you should instead firstly open a command prompt and then run 'startup.bat' from within this prompt.  Any errors will remain visible in the command prompt and can be debugged as a result.  To do this, simply select 'START' -> 'Run'  -> cmd   (in Windows XP).  Then navigate to your TOMCAT_HOME/bin directory, by typing for example. cd Java/apache-tomcat-7.0.85/bin  <enter>   startup.bat
  • The most common error with Tomcat relates to it being unable to locate Java, which it requires to run.  Ensure that you have setup your JAVA_HOME environment variable correctly and try again.  Details on setting this were explained in the Java Downloads section and Video
  • Avoid putting your Tomcat installation in 'Program Files' on Windows.  This might cause problems at a later stage. For example, your OS may prevent Eclipse from controlling Tomcat and editing configuration files.  So install in a non-special directory on your harddrive, such as what I did in the examples above.
  • For further problems, please use the course mailing list providing as much detail as you can provide, such as operating system, versions, symptoms and the errors being encountered.

Useful Points of Note

  • The preconfigured Tomcat has a user (Username: admin, Password: admin) set up to use the Tomcat Manager tool.  You can use this facility to start/stop/reload and deploy applications.  In general, we will not use this approach for deployment, but it can prove useful for restarting applications during development.
  • The servlet/JSP examples can be found on the navigation bar under 'Examples'.  These are very useful examples which will be available to you during the examination.  For this reason, it is important that you do NOT try to memorize code templates such as HelloWorld servlets etc.  

Comments