[JAVA][Apache Tomcat 7 User Guide].pdf

(849 KB) Pobierz
Apache Tomcat 7
User Guide
by
The Apache Software Foundation


Fultus
Books
Apache Tomcat 7
User Guide
by
The Apache Software Foundation
ISBN-10: 1-59682-271-6
ISBN-13: 978-1-59682-271-9
Copyright © 1999-2011, Apache Software Foundation
Cover design and book layout by Fultus Corporation
Fultus Corporation is not affiliated with The Apache Software Foundation

Published by Fultus Corporation
Publisher Web:
Linbrary - Linux Library:
Online Bookstore:
email:
www.fultus.com
www.linbrary.com
store.fultus.com
production@fultus.com
This work is licensed under the Apache License, Version 2.0.
To view a copy of this license, visit
http://www.apache.org/licenses/LICENSE-2.0.
Apache and the Apache feather logo are trademarks of The Apache Software Foundation.
, in the U.S.
and other countries. All product names and services identified throughout this manual are trademarks or
registered trademarks of their respective companies.
The authors and publisher have made every effort in the preparation of this book to ensure the accuracy of the
information. However, the information contained in this book is offered without warranty, either express or
implied. Neither the author nor the publisher nor any dealer or distributor will be held liable for any damages
caused or alleged to be caused either directly or indirectly by this book.
Table of Contents
Table of Contents
Abstract ............................................................................................................................................... 14
Chapter 1. Introduction .................................................................................................................... 15
1.1. Introduction ............................................................................................................................. 15
1.2. Terminology............................................................................................................................. 15
1.3. Directories and Files ............................................................................................................... 15
1.4. Configuring Tomcat................................................................................................................ 16
1.5. Where to Go for Help ............................................................................................................. 16
Chapter 2. Tomcat Setup.................................................................................................................. 18
2.1. Introduction ............................................................................................................................. 18
2.2. Windows .................................................................................................................................. 18
2.3. Unix daemon ........................................................................................................................... 19
Chapter 3. First webapp ................................................................................................................... 21
3.1. Preface....................................................................................................................................... 21
3.2. Introduction ............................................................................................................................. 21
3.2.1. Overview ........................................................................................................................... 21
3.2.2. Links ................................................................................................................................... 21
3.3. Installation................................................................................................................................ 22
3.3.1. JDK ..................................................................................................................................... 22
3.3.2. Tomcat ............................................................................................................................... 22
3.3.3. Ant ...................................................................................................................................... 23
3.3.4. CVS ..................................................................................................................................... 23
3.4. Deployment ............................................................................................................................. 23
3.4.1. Background ....................................................................................................................... 23
3.4.2. Standard Directory Layout ............................................................................................. 24
3.4.3. Shared Library Files ......................................................................................................... 25
3.4.4. Shared Library Files ......................................................................................................... 25
3.4.5. Web Application Deployment Descriptor .................................................................... 25
3.4.6. Tomcat Context Descriptor ............................................................................................. 26
3.4.7. Deployment With Tomcat............................................................................................... 26
3.5. Source Organization ............................................................................................................... 27
3.5.1. Directory Structure .......................................................................................................... 27
3.5.1.1. External Dependencies ................................................................................ 29
3
Apache Tomcat 7
User Guide
3.5.2. Source Code Control ....................................................................................................... 30
3.5.3. BUILD.XML Configuration File..................................................................................... 31
3.6. Development Processes ......................................................................................................... 32
3.6.1. One-Time Setup of Ant and Tomcat for Development .............................................. 33
3.6.2. Create Project Source Code Directory ........................................................................... 33
3.6.3. Edit Source Code and Pages ........................................................................................... 35
3.6.4. Build the Web Application ............................................................................................. 35
3.6.5. Test Your Web Application ............................................................................................ 36
3.6.6. Creating a Release ............................................................................................................ 37
3.7. Sample Application ................................................................................................................ 37
Chapter 4. Tomcat Web Application Deployment ..................................................................... 38
4.1. Introduction ............................................................................................................................. 38
4.2. Installation ............................................................................................................................... 38
4.3. A word on Contexts................................................................................................................ 39
4.4. Deployment on Tomcat startup ............................................................................................ 39
4.5. Deploying on a running Tomcat server ............................................................................... 40
4.6. Deploying using the Tomcat Manager ................................................................................ 41
4.7. Deploying using the Client Deployer Package................................................................... 41
Chapter 5. Manager App HOW-TO .............................................................................................. 43
5.1. Introduction ............................................................................................................................. 43
5.2. Configuring Manager Application Access .......................................................................... 44
5.3. Supported Manager Commands .......................................................................................... 45
5.3.1. Deploy A New Application Remotely .......................................................................... 46
5.3.2. Deploy A New Application from a Local Path............................................................ 47
5.3.3. List Currently Deployed Applications.......................................................................... 50
5.3.4. Reload An Existing Application .................................................................................... 51
5.3.5. List OS and JVM Properties ............................................................................................ 51
5.3.6. List Available Global JNDI Resources .......................................................................... 52
5.3.7. Session Statistics ............................................................................................................... 52
5.3.8. Start an Existing Application ......................................................................................... 53
5.3.9. Stop an Existing Application .......................................................................................... 53
5.3.10. Undeploy an Existing Application .............................................................................. 54
5.3.11. Finding memory leaks................................................................................................... 55
5.3.2.1. Deploy a version of a previously deployed webapp ............................... 48
5.3.2.2. Deploy a Directory or WAR by URL.......................................................... 48
5.3.2.3. Deploy a Directory or War from the Host appBase ................................. 48
5.3.2.4. Deploy using a Context configuration ".xml" file..................................... 48
5.3.2.5. Deployment Notes ........................................................................................ 49
5.3.2.6. Deploy Response ........................................................................................... 49
4
Zgłoś jeśli naruszono regulamin