Installing JSP on Windows Server 2003

I once had to do this and I found this rather hard to actually get working 100%, there are many guides on the net but nothing that would work 100% for me so I did wrote a guide some time ago, hopefully this can help one else out. The website that I performed this write on comprised of JSP and SHTML.

 

Required Installs / files

IIS 6.0

Java 2

Tomcat 5.5

Perl

MySQL

MySQL Administrator

MySQL J Connector

 

Install MySQL and MySQL Administrator, make sure that you have also imported the required databases, do not change any naming for the databases, as the JSP code refers directly to the  DB name.

First Step is to install you IIS server

Adding the Application Server Role to Windows Server 2003
When you start your server, you should see the Manage Your Server wizard. If you don’t display this by default, you can go to Administrative Tools and click on Manage Your Server. When the wizard opens, click on Add or Remove a Role.
clip_image001
Click Next and let the server detect your settings, then choose Custom Configuration and click Next, then choose the Application Server role and click Next This should bring you to the Application Server Options screen of the wizard.

clip_image002

At this point we want to choose ASP.NET, just in case later there is a need for it, the Front Page extensions are not required.

click Next to set up the role. The process may ask you for the Server 2003 CD and will take several minutes to complete. Just let it run until you see the Finish button, then click Finish.

Your IIS 6.0 is now installed, be sure to test this before moving on

Installing Java

Step 1.  Install the JRE
Install the JRE and choose a custom installation which will allow you to change the installation directory to D:\java (or leave it as the default C:\program files\Java if you prefer)
clip_image003
Fig.1 Installing the JRE
clip_image004
Fig.2 Select a Custom Installation
clip_image005
Fig.3 Choose the target Installation Directory
clip_image006
Fig.4 Installation Complete
Once this is done you need to set a system environment variable which will enable Tomcat to compile JSP pages at runtime. To do this right-click the My Computer icon, select properties and then the Advanced tab. Then click Environment Variables and under System variables click New
clip_image007
Fig.5  Setting the Environment Variable
Then add a new system variable with the name of JAVA_HOME and a value of D:\Java (or whichever directory you specified for your Java installation)
clip_image008
Fig.6  Setting the Java Environment Variable
Tomcat 5.5 also requires a system environment variable to be set so lets go ahead and do that whilst we are here. The Tomcat variable is called CATALINA_HOME and needs to be a system variable which points to the root of your Tomcat installation directory. In this example I am going to install Tomcat into D:\Tomcat so I set the variable accordingly
clip_image009
Fig.7  Setting the Tomcat Environment Variable

Installing Tomcat 5.5
Now we begin the installation of Tomcat itself.
clip_image010
Fig. 8 Tomcat Setup Dialog
Launch the installer, agree to the licensing and then select Full Install. Selecting either a full or custom install will give you the Examples and Webapps which will allow you to test your Tomcat installation to ensure everything is working properly.
clip_image011
Fig.9 Select a Full Installation Type
At the Choose Install Location dialog box, click browse and select your preferred directory. In this example I am going to install into D:\Tomcat (again you may use the default if you wish C:\Program Files\Apache Software Foundation\Tomcat 5.5)
clip_image012
Fig.10 Choosing the Installation Location
Next you need to select the HTTP/1.1 Connector Port, which is the port the Tomcat service itself will actually be listening on. Provided nothing else on your server is using this port then leaving it set to the default of 8080 is fine. (this is what I have used)
You also then need to select a user name and password for your Tomcat admin account.

clip_image013
Fig.11 Configuring the Tomcat Connector port and Administrator password
The Tomcat installation should find your default Java installation directory, if not then direct it accordingly. Click Install and you should soon have a working installation of Tomcat !
clip_image015
Fig.12 Configuring the JVM path

Once you installation has finished Go to the windows services, you will see that the installation has added a new service called Apache Tomcat which should be set to start automatically, if not do this. Also the service will normally use the local system for logging on, change this to the administrator user and password of the server. Tomcat also provides an interface where this can be achieved, however I found this to give me nothing but problems, stick to the windows services.
clip_image017
Fig. 14 The Apache Tomcat service
Now we need to test our installation and make sure that Tomcat is working, to view the tomcat welcome page in the browser type: localhost:8080, at this point you should see the default welcome page for Apache Tomcat
clip_image018
Fig. 15 The Default Tomcat page.
Also you can also test the examples or sample applications which you installed earlier by pointing your browser to either http://localhost:8080/jsp-examples/ or http://localhost:8080/servlets-examples/ I recommending doing this, as a double check to make sure the tomcat is communicating with all of the other ‘web apps’

clip_image019
Fig. 16 Browsing the samples using Tomcat directly
Now we need to create the website as a web app to so we can browse the JSP side of the  website, the required files can also be found in the install folder, copy the website folder and then go to you Tomcat installation folder, within the install folder you will have a folder called ‘Web Apps’ go into this folder in there you will find several folders such as jsp-examples, servlet-examples and a few others, paste you website folder in the root of the Web Apps folder.

So that’s the first part done. You now have Tomcat installed and working on a Windows 2003 Server machine. Next, we need to configure IIS to accept requests on behalf of Tomcat on port 80

Installing and Configuring the Tomcat JK2.0.4 Connector for IIS
The Tomcat connector is an ISAPI filter which allows IIS to handle requests for Java pages or applications and passes them off to Tomcat for processing.

Here we start by browsing to the installs\tomcat directory, in there you will find ‘setupJk204.exe’ this is how we setup the ISAPI filter within IIS.

clip_image021

Fig.17 Starting the ISAPI redirector

After pressing next it will ask you to agree, do this and then you will be presented with a screen where you are able to choose you web applications you want IIS and Tomcat to talk to

clip_image023

Fig.18 choosing the web app we want the filter to run

Make sure you choose your website, the other can be chosen if you like, once you are happy with you selections then choose Install.

Once we have installed this go back into the IIS and the make sure that that the ISAPI filter has been installed and is allowed.

clip_image025

Figure.19 as you can see the ISAPI filter is installed ‘Jakarta Isapi Redirector’

More Configuring IIS
There are a few steps which need to be completed in order to get Tomcat to work with IIS6,
We need to create a virtual directory for the Tomcat connector to use, however before this we need to add the website, so create a new site call it what ever you like, and then add the website directorty which in my case was found E:\Websites\xxxxxxx\xxxxxxx\xxxxx, once this has been created we now can create a Virtual Directory, call it what ever you wish (I called mine Jakarta), the next part asks for a path we need to find the path of the ISAPI filter, if you have installed tomcat to the default location you will find it: C:\Program Files\Apache Software Foundation\Tomcat 5.5\native\i386

clip_image027

Figure.20 Enter the location of the ISAPI filter.

Next, be sure to give the Virtual Directory READ, RUN Scripts and EXECUTE permissions

clip_image029

Figure.21 the permissions that are required

Create the Tomcat Application Pool
In IIS Manager and right-click Application Pools. Click New, Application Pool. Select a name for your new application pool and use the default settings to create the new pool. You should now see your new application pool in the list. Once you do go back to the  website and give this website the new application pool, also make sure that all other Virtual directory inherit this App Pool.

Check the ISAPI

Click on the properties of the website, and go to ISAPI filters, and check that you filter has appeared, if it is not there add it by navigating to the location of it (default location: C:\Program Files\Apache Software Foundation\Tomcat 5.5\native\i386).

clip_image031

Figure.22 the ISAPI filter is in place

Installing Pearl

Ok now that we have tomcat working, we need to do a few more things for the whole site to function properly, so we are now insdtalling perl, again you will find this install in the \install directory, just install this anywhere you wish. This is a simple Next, next process.

clip_image033

Figure.23 open
the pl ext

Once this is complete, you will see that pearl has added some required IIS extensions, however one of the required extension is missing, so we need to add it Double click on the .pl Ext and then copy the Executable path, then press cancel to the .pl ext, and choose the add button and paste the path into the ‘Executable’

And type

.cgi

Then press ok.

clip_image035

Figure.24 adding the CGI ext

Final Step

Installing the MySQL J connector

Navigate to E:\Installs\MySQL\mysql-connector-java-3.1.14 in this folder you will find serval .JAR files we are interested in the ‘mysql-connector-java-3.1.14-bin.jar’ copy this file.

We now need to paste this in 2 locations

  1. C:\Program Files\Java\jre1.5.0_01\lib\ext (this is the default installation folder for Java, choose the according folder that is right for you)
  2. C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\WEBSITE\WEB-INF\lib (again this the default installation path for tomcat, make sure you change yours accordingly)

Now you are done!!!

Test your site.


10 Responses to “Installing JSP on Windows Server 2003”

Leave a Reply