Local WebServer – Apache Tomcat


Pre-requisites: You should have Apache Tomcat installed on your machine, downloadable from http://tomcat.apache.org/download-60.cgi and you should have eclipse 3.6 on your machine
Configure the webserver to be used within eclipse as follows:

1.       Unzip the download into your local directory
2.       Tell Eclipse about Tomcat

First, start Eclipse and go to the Workbench as shown in the previous section. Then, click on Servers tab at bottom. R-click, New, Server, Apache, Tomcat v6.0, navigate to folder, OK. You should now see "Tomcat v6.0 Server at localhost" listed under the Servers tab at the bottom.
 

3. Run Tomcat.
Click on Servers tab at bottom. R-click on Tomcat v6.0, choose "Start". Open http://localhost/ in a browser: you should see an empty page showing a blank directory listing (but not a 404 error). Eclipse incorrectly fails to copy the welcome pages when it sets up Tomcat, so if you want the friendlier welcome page, go to your-eclipse-workspace.metadata and search for "ROOT". Copy all of the files from C:apache-tomcat-6.0.28webappsROOT into the ROOT folder inside your-eclipse-workspace.metadata...ROOT. 
If you fail to copy the ROOT files as mentioned above, http://localhost/ will result in an empty directory listing. It is often mistaken for an error page, but if you look closely you will see that it says "directory listing for /" and is not an error at all. However, if you copy the ROOT files, http://localhost/ will give the nice friendly "Welcome to Tomcat" page.
4.  Make empty project.
a.       File, New, Project, Web, Dynamic Web Project.
b.      Give it a name (e.g., "SampleWebServer").
c.       Accept all other defaults.

5. Make a Welcome.html and place it on the ‘WebContent’ folder of your new Dynamic Web App.
6. Now if you type http://localhost:8080/SampleWebServer/Welcome.htmlin your browser, you should be able to view the page. 



Related Posts by Categories

0 comments:

Post a Comment

Blog Archive

Powered by Blogger.