Java Tutorial - Java Scipt : Using the Tomcat Admin Tool

Java Tutorial - Java Scipt :

Using the Tomcat Admin Tool

The Tomcat Administration Tool is a great improvement over the old means of configuring Tomcat by editing configuration files. To start the Admin utility first make certain that Tomcat is running, and then enter the following URL into the browser.

The machine and port may need to be changed to reflect your configuration. You will be prompted for a username and password. The username and password are the ones you created when installing Tomcat. After you are logged in, you should see a screen that looks like Figure 8.8.

Using the navigation tree on the left-hand pane, select Service Host (localhost), and open the tree. If a branch does not exist for Default Context, then create one by selecting the Host node and then selecting Create New Default Context from the pull-down menu of available actions on the right. A form appears in the left pane with the values that can be set for the DefaultContext tag. Most of these can be left at their default values, but make certain that the value for Use Naming is set to true. There are Save buttons at the top and bottom of the form that can be used to save the values and create the Default Context.

Figure 8.8 Tomcat administration screen.

After the Default Context has been created, we need to add the DataSource to it. Use the Navigation tree on the left to navigate to the Default Context node that we just created, and open it and the Resources node below it. Anode for Data Sources should appear below the Resources node. Select the Data Sources node. The Action menu on the right should now have an option to create a new DataSource. Selecting this option presents us the screen shown in Figure 8.9.
Use the values from Tables 8.4 and 8.5 to fill in the form. The other fields can be left at their default values. After the form has been completed, click the Save button and then restart Tomcat.

 A number of people have reported problems using Tomcat’s Administration Tool to create pooled connections through Tomcat version 4.1.24. Most who have encountered problems have found a workaround by configuring the resources in the application context or default context instead of configuring them in the Global Resources. This is what we have shown with these instructions. Occasionally, however, even configuring the resource in the default context fails. When that happens, manually configuring the resource by editing server.xml will often work. The instructions for doing this are provided in the next section. If you have tried to use the Administration Tool, you may want to reinstall the server.xml file in the conf directory of the Tomcat installation. The Administartion tool generates a server.xml file that is difficult to read.