Getting Your Local Java Development Environment Set Up Page II


P.G. Daly

Go to page: 1  2 

02/20/02

Printer Friendly Version

Configure

====================================

Once you get both Apache and Tomcat installed and working stand-alone, it is time to configure the two to work together.  That is, having Apache handle the basic http requests and know how to forward requests for JSP pages and servlets to Tomcat.  Before I list the steps needed to do a basic configuration, lets take a look at the directory structures of both Apache and Tomcat as installed above.

Apache

 

 

Tomcat

These screenshots will help you better understand the configuration changes we are making.  For the purpose of simplicity, <ApacheInstallDirectory> will refer to the folder where you installed Apache (in the case above that translates to c:\Program Files.  Similarly, <TomcatInstallDirectory> refers to the folder where you installed Tomcat and in my scenario above that translates to c:\jakarta-tomcat.

1.        Extract the ApacheModuleJServ.zip file (or copy the ApacheModuleJServ.dll file) to the following location: <ApacheInstallDirectory>/Apache Group/Apache/Modules

2.        Open the file <ApacheInstallDirectory>/Apache Group/Apache/conf/httpd.conf for editing.  You might want to make a backup copy of all the defaults of the configuration files before editing in case you make a mistake.  Scroll to the end of the file and add the following line:

Include “TomcatInstallDirectory/conf/jserv/tomcat.conf”

3.        Open the file <TomcatInstallDirectory>/conf/jserv/tomcat.conf. Uncomment (remove the “#” symbol) from the following line and edit it to look as follows:

LoadModule jserv_module modules/ApacheModuleJServ.dll

4.        Uncomment the following line (you are still editing tomcat.conf):

ApJservDefaultHost localhost

5.        Set your Home variables, Start Tomat, Start Apache

6.        Test a JSP file.  You can test this by using the following URL, which will refer to an example file included in the default installation.  Open your browser and type http://localhost/examples/jsp/index.html then choose one of these to execute.  If it works, you have success.

7.        Test a servlet.  Once again, you can test this by referring to an example provided in the default installation.  Open your browser and type http://localhost/examples/snoop.  You should see the output of the Snoop Servlet.  If this works, again you have success.

Keep in mind that these steps will get you up and running.  Obviously, there are numerous other considerations and possible configuration options.  I certainly don’t claim to be a server guru, so I can’t speak very knowledgeably about the finer points of server configuration and won’t fool you into thinking I can.  If you need to set up Apache and Tomcat for more than just a development environment, you should definitely spend some time perusing the user guides, FAQ’s, and other articles on the Apache Project homepage (http://www.apache.org).  In addition, the JGuru site has some helpful tips and links on the topic as well (http://www.jguru.com).  If you are planning on delving into the depths of this and these sites, be prepared for a decent amount of reading and some struggle with pulling the pieces together.  The authors of many of these articles are knowledgeable about their subject in a big big way, but are not always very user-friendly in terms of how they write and present the information.

Now that you have your environment set up, I will soon talk about how to configure the different contexts, offer some advice for setting up your directory structures, and help you write your first Hello World servlet to test things out.



Go to page: 1  2 

Printer Friendly Version