Creating a Web Application with Ant and Tomcat 4
Pages: 1, 2, 3, 4
Tomcat Administration
To login to Tomcat's Web-based administration, point your browser at http://localhost:8080/admin.
You will be presented with a login screen. Enter your Tomcat "admin" username
and password. These are the same as the "manager" username and password:
tomcatusername and tomcatpassword. The
tomcat-users.xml file has been set up with a single account with
admin, manager, and provider roles. It is a trivial change to set up multiple
Tomcat accounts each with separate roles.
The resulting Web page is split into three panels: a heading panel, a tree panel, and a data panel. You can see this sequence of Web pages in Figure 7.

The tree can be used in the normal way -- branches can be opened, selected,
etc. Open the Service (Tomcat-Standalone) branch, then the
Host (localhost) branch, then the Context (/AddressBook) branch, and finally AddressBook's Resources branch.
Note the global Resources branch further down the tree panel.
Do not mix up the global Resources branch with AddressBook's
Resources branch. You may define global
javax.sql.DataSource resources that can be used by any Web
application in the global Resources branch.
AddressBook's Context Panel
Select the Context (/AddressBook) branch. AddressBook's context
panel will appear in the data panel. You can see AddressBook's Context Web page
in Figure 8.

You may make any changes you wish -- most interestingly, the three different
Debug Level parameters. To save the changes, press the
Save button, then press the Commit Changes button in
the heading panel.
AddressBook's Data Source Panel
Select the Data Sources branch in the Context
(/AddressBook)'s Resources branch of the tree.
AddressBook's data sources panel will appear in the data panel.
Select the data source jdbc/Public to view that specific
javax.sql.DataSource. You can see AddressBook's Data Source Web
page in Figure 9.

You may make any changes you wish -- most interestingly, the Data Source
URL, JDBC Driver Class, User Name,
Password, Max. Active Connections, Max. Idle
Connections, and Max. Wait for Connection. To save the
changes, press the Save button, then press the Commit
Changes button in the heading panel.
If you are simply working on your personal computer, this may not seem to be
very important, but on your company's production Web server environment, this is
a really important facility. These parameters are likely to change, and you
don't need to be a programmer to change them -- a Tomcat administrator can do
it. As a programmer, my head is already full of usernames and passwords, and I
don't want to know any more. I certainly do not want to know my company's
production database username and password. Quite rightfully, too -- such information
should be on a need-to-know basis, and, because of
javax.sql.DataSources, and Tomcat 4's administration service, I no
longer need to know.
Using Ant to establish a Web application's context is fine when developing the software. Tomcat's administration service comes into its own in the production environment.
AddressBook's Logger Panel
Select the Logger for Context (/AddressBook) branch in the
Context (/AddressBook) branch of the tree. AddressBook's logger
panel will appear in the data panel. You can see AddressBook's Logger Web page
in Figure 10.

You may make any changes you wish -- the most interesting options are Debug
Level and Verbosity Level. To save the changes, press
the Save button, then press the Commit Changes button
in the heading panel.
Biblography
This article could not have been written without the assistance of these documents:
Tomcat Servlet/JSP Container Documentation
You can get the
latest Tomcat, which includes documentation, from http://jakarta.apache.org/tomcat.
Java Web Services Developers Pack Tutorial
You can get the
latest Java Web Services Developers Pack Tutorial from java.sun.com/webservices/tutorial.html.
Paul Wood has been programming for 32 years and is now a freelancer.
Return to ONJava.com.
-
Re:
2010-03-24 10:27:24 SophieGreen [View]
-
Fix for id after deleting records
2006-02-07 04:26:54 nav327 [View]
-
Fixing Null pointer exception
2006-02-07 04:08:58 nav327 [View]
-
Fixing Null pointer exception...i forgot
2006-02-09 01:48:28 nav327 [View]
-
Wow!
2005-04-04 06:23:40 ITVGuy2000 [View]
-
Oh Well
2005-04-04 19:07:52 ITVGuy2000 [View]
-
Thanking you!!!!!!!!!
2005-01-23 23:57:45 KEENFORJAVA [View]
-
Great Site for beginner
2007-01-29 19:42:39 redeville [View]
-
Build Failed ...
2004-11-26 21:15:02 lovemw [View]
-
Build Failed ...
2004-12-21 14:18:23 nt_yng [View]
-
Including JSTL
2004-06-21 03:51:54 wolfgang_r [View]
-
Understanding the source code
2004-05-31 12:44:12 wolfgang_r [View]
-
Understanding the source code
2004-05-31 12:50:39 wolfgang_r [View]
-
Authentication in jakarta-tomcat-4.0.6-LE
2004-01-24 04:51:41 vimal1 [View]
-
Debug Level?
2004-01-12 17:22:16 anonymous2 [View]
-
Great article, but I can't deploy my war.
2003-10-22 02:15:06 anonymous2 [View]
-
BRILLIANT
2003-10-12 20:49:50 anonymous2 [View]
-
AddressBook
2003-08-02 08:04:46 anonymous2 [View]
-
tomcat, ant and apache
2003-07-28 04:57:08 franci [View]
-
app won't run
2003-06-15 23:01:35 anonymous2 [View]
-
app won't run
2003-12-09 21:16:14 anonymous2 [View]
-
solution to database connection problem
2003-06-12 03:57:36 anonymous2 [View]
-
BUILD FAILED
2003-06-03 16:45:26 anonymous2 [View]
-
BUILD FAILED
2003-07-11 09:57:41 anonymous2 [View]
-
Terrific Piece of Work
2003-05-27 14:43:49 anonymous2 [View]
-
DBCP borrowObject failed: null
2003-04-18 09:38:47 anonymous2 [View]
-
DBCP borrowObject failed: null
2003-11-19 03:14:33 anonymous2 [View]
-
DBCP borrowObject failed: null
2003-11-12 07:05:36 lisa_blanshard [View]
-
Microsoft Access
2003-04-09 13:05:57 anonymous2 [View]
-
Can't run :(
2003-03-20 04:13:17 anonymous2 [View]
-
Can't run :(
2003-04-01 15:05:03 anonymous2 [View]
-
Can't run :(
2003-10-02 16:13:21 anonymous2 [View]
-
could not create resource factory
2003-03-17 07:09:56 anonymous2 [View]
-
could not create resource factory
2003-04-03 15:21:29 anonymous2 [View]
-
PDF Format
2003-03-10 23:37:29 anonymous2 [View]
-
Great article! I need help
2003-03-07 01:48:39 anonymous2 [View]
-
Cannot load JDBC driver class 'null'
2003-03-06 16:44:11 anonymous2 [View]
-
Cannot load JDBC driver class 'null'
2003-08-06 06:58:56 anonymous2 [View]
-
Cannot load JDBC driver class 'null'
2003-08-22 15:26:50 anonymous2 [View]
-
BRILLIANT ARTICLE!!!
2003-03-06 08:09:34 anonymous2 [View]
-
How to use "private" databases?
2003-03-04 01:55:57 anonymous2 [View]
-
no connection to the database: DBCP borrowObject failed
2003-03-01 11:13:17 anonymous2 [View]
-
no connection to the database: DBCP borrowObject failed
2003-03-05 06:09:46 wenbo_luo [View]
-
no connection to the database: DBCP borrowObject failed
2003-07-16 14:00:31 anonymous2 [View]
-
no connection to the database: DBCP borrowObject failed
2003-11-03 22:49:58 anonymous2 [View]
-
no connection to the database: DBCP borrowObject failed
2003-04-05 05:03:33 anonymous2 [View]
-
no connection to the database: DBCP borrowObject failed
2003-03-02 00:53:18 ossipetz [View]
-
no connection to the database: DBCP borrowObject failed
2003-03-01 16:50:14 ossipetz [View]
-
no connection to the database: DBCP borrowObject failed
2003-03-01 16:35:23 ossipetz [View]
-
no connection to the database: DBCP borrowObject failed
2003-03-01 16:32:07 ossipetz [View]
-
install succeed now but...
2003-02-26 14:54:19 anonymous2 [View]
-
ant install failed...
2003-02-26 14:04:10 anonymous2 [View]
-
ant install failed...
2003-03-01 11:22:45 ossipetz [View]
-
ant install failed...
2005-11-30 04:51:42 buzzz [View]
-
Wonderful article, but need some help.
2003-02-24 02:35:59 anonymous2 [View]
-
Wonderful article, but need some help.
2003-05-13 06:28:02 anonymous2 [View]
-
Wonderful article, but need some help.
2003-02-24 13:16:53 anonymous2 [View]
-
Decent intro article, but mention the alternatives
2003-02-15 13:39:47 anonymous2 [View]
-
Cannot load JDBC driver class 'null'
2003-02-12 07:46:17 anonymous2 [View]
-
Cannot load JDBC driver class 'null'
2003-02-16 14:03:16 woodp [View]
-
Changes to home.jsp
2003-02-11 08:46:01 anonymous2 [View]
-
Really great article !!!
2003-02-06 09:19:03 anonymous2 [View]
-
rsp to post
2003-02-04 16:25:43 anonymous2 [View]
-
rsp to post
2003-02-16 14:07:57 woodp [View]
-
response to Name jdbc is not bound in this Context
2003-02-04 16:25:02 anonymous2 [View]
-
Name jdbc is not bound in this Context
2003-02-04 16:24:47 anonymous2 [View]
-
Name jdbc is not bound in this Context
2003-02-04 16:24:31 anonymous2 [View]
-
International chars?
2003-02-04 12:11:55 anonymous2 [View]
-
International chars?
2003-02-04 12:11:37 anonymous2 [View]
-
Misleading code
2003-02-03 15:44:09 anonymous2 [View]
-
Misleading code
2003-02-02 03:02:42 anonymous2 [View]
-
Misleading code
2003-02-03 15:45:12 anonymous2 [View]
-
Misleading code
2003-06-30 15:10:19 anonymous2 [View]
-
Name jdbc is not bound in this Context
2003-01-27 19:11:20 anonymous2 [View]
-
Definite and direct instruction
2003-01-27 10:00:34 anonymous2 [View]
-
Definite and direct instruction
2003-01-27 13:49:18 anonymous2 [View]
-
Name jdbc is not bound in this Context
2003-01-26 14:40:00 anonymous2 [View]
-
Name jdbc is not bound in this Context
2003-01-27 13:51:17 anonymous2 [View]
-
Name jdbc is not bound in this Context
2003-10-29 17:05:35 anonymous2 [View]
-
context.xml
2003-01-25 05:00:00 anonymous2 [View]
-
context.xml
2003-01-26 13:00:06 woodp [View]
-
Directory Structure
2003-01-25 02:09:53 anonymous2 [View]
-
Directory Structure
2003-01-26 13:04:32 woodp [View]
-
How about international characters...
2003-01-23 09:03:09 anonymous2 [View]
-
How about international characters...
2003-01-23 10:15:13 woodp [View]
-
Comments on use of HTML and JSP
2003-01-13 15:10:06 anonymous2 [View]
-
Comments on use of HTML and JSP
2003-01-14 15:48:17 woodp [View]
-
Good article, maybe, but terrible code
2003-01-13 08:55:50 anonymous2 [View]
-
Good article, maybe, but terrible code
2003-01-14 15:48:02 woodp [View]
-
Great Article
2003-01-09 08:21:40 anonymous2 [View]
-
Great Article
2008-05-22 22:47:36 magna [View]
-
Address Book
2003-01-09 07:31:58 anonymous2 [View]