Creating an Apache Tomcat server and Web project

If you plan to create a Web service that uses Apache Jakarta Tomcat as its server, Tomcat must be installed and a server created before you begin creating your Web service.

Install Apache Jakarta Tomcat from this URL: http://jakarta.apache.org/tomcat

Once you have installed the server, create a Tomcat server in the workbench by doing the following:

  1. From the File menu, select

    New > Other > Server > Server > Next.

  2. Select Tomcat v 3.x, 4.x, v5.x, or 6.x as the server type, electing the correct version of Tomcat for your install, and click Next.

  3. On the Tomcat server page:

    1. Enter a server name.

    2. Specify where Tomcat is installed.

    3. Click

      Installed JREs, click

      Add, and enter the appropriate information for the JDK you plan to use for Tomcat. For example, for Tomcat v5.0 the JRE name would be jdk141 and the JRE home would be the home directory for JDK 1.4.1. Click OK twice once you have entered this information. Ensure that the newly added JDK is now selected in the JRE field of the Tomcat server page. Note that if you point the server at a JRE rather than a JDK the JSPs will not properly compile and will not be able to run on the Tomcat server.

  4. Click Finish. To see the server you have created in the workspace, from the Window menu select

    Show view > Other > Server > Servers > Ok.

To build a dynamic Web project that points to the Tomcat server that you have created:

  1. Create the service Web project by selecting

    New > Dynamic Web project. Enter the following information:

    • Project Name: enter a project name

    • Target runtime: Tomcat server v3.x, 4.x, 5.x, or 6.0 depending on the version you installed. If it is not listed, click New and browse to the location where it is installed.

    • Ensure that

      Add project to an EAR is not selected.

  2. Click Finish.

  3. To associate the project with the server, right-click the Tomcat server you created in the Server view and select

    Add and remove projects. Select the service and client projects from the Available projects list and click

    Add.